Module Name:    src
Committed By:   rillig
Date:           Mon Dec 13 07:06:39 UTC 2021

Modified Files:
        src/usr.bin/make: cond.c

Log Message:
make: fix memory leak when parsing '.if ${expr}' (since 2004-04-13)

$ (
        echo 'VAR=value'
        perl -e 'printf(".if \${VAR}\n.endif\n" x 5000);';
        echo 'all:'
        printf '\t%s\n' \
            '@pid=$$$$; \' \
            'ppid=$$(ps -o ppid -p "$$pid" | sed 1d); \' \
            'ps -o vsz,rsz -p $$ppid | sed 1d'
) > leak-cond2.mk

$ make-2004.04.08.07.24.26 -r -f leak-cond.mk
2668
$ make-2004.04.13.16.06.23 -r -f leak-cond.mk
3964

$ echo $(((3964 - 2668) * 1000 / 5000))
259

This 259 is close enough to the 256 from Buf_Init in CondParser_Leaf.


To generate a diff of this commit:
cvs rdiff -u -r1.302 -r1.303 src/usr.bin/make/cond.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Reply via email to