Allocate -o OUTFILE buffer only if needed

text	   data	    bss	    dec	    hex	filename
 238258	    668	  28676	 267602	  41552	strace.before
 238274	    668	  20484	 259426	  3f562	strace

* strace.c (main): Allocate -o OUTFILE buffer only if needed:
unused buffer in bss is not entirely free.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2012-01-24 11:31:51 +01:00
parent 82bb78c149
commit a677da5e3f

View File

@ -1182,7 +1182,9 @@ main(int argc, char *argv[])
}
if (!outfname || outfname[0] == '|' || outfname[0] == '!') {
static char buf[BUFSIZ];
char *buf = malloc(BUFSIZ);
if (!buf)
die_out_of_memory();
setvbuf(outf, buf, _IOLBF, BUFSIZ);
}
if (outfname && optind < argc) {