]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
logger: fix memory leaks
authorSami Kerola <sami.kerola@lastminute.com>
Tue, 7 Apr 2015 07:58:19 +0000 (08:58 +0100)
committerSami Kerola <sami.kerola@lastminute.com>
Tue, 7 Apr 2015 07:58:19 +0000 (08:58 +0100)
Reported-by: Patrick Plagwitz <patrick.plagwitz@fau.de>
Signed-off-by: Sami Kerola <sami.kerola@lastminute.com>
misc-utils/logger.c

index 753cd7f9951e84ff371db4771337e3e3030d69d2..6316a76fc1aa464af59a1820983c3367e1fd7f85 100644 (file)
@@ -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)