From c3dd2ecd5fcaf30860d5fcfd74edfd70a3dd7603 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Tue, 7 Apr 2015 08:58:19 +0100 Subject: [PATCH] logger: fix memory leaks Reported-by: Patrick Plagwitz Signed-off-by: Sami Kerola --- misc-utils/logger.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) -- 2.47.2