From: Sami Kerola Date: Tue, 7 Apr 2015 07:58:19 +0000 (+0100) Subject: logger: fix memory leaks X-Git-Tag: v2.27-rc1~286 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c3dd2ecd5fcaf30860d5fcfd74edfd70a3dd7603;p=thirdparty%2Futil-linux.git logger: fix memory leaks Reported-by: Patrick Plagwitz Signed-off-by: Sami Kerola --- diff --git a/misc-utils/logger.c b/misc-utils/logger.c index 753cd7f995..6316a76fc1 100644 --- a/misc-utils/logger.c +++ b/misc-utils/logger.c @@ -395,9 +395,9 @@ static void write_output(const struct logger_ctl *ctl, const char *const msg) warn(_("write failed")); } } - if (ctl->stderr_printout) fprintf(stderr, "%s\n", buf); + free(buf); } #define NILVALUE "-" @@ -625,6 +625,7 @@ static void logger_command_line(const struct logger_ctl *ctl, char **argv) } if (p != buf) write_output(ctl, buf); + free(buf); } static void logger_stdin(struct logger_ctl *ctl)