diff options
author | Sami Kerola | 2015-04-07 09:58:19 +0200 |
---|---|---|
committer | Sami Kerola | 2015-04-07 09:58:19 +0200 |
commit | c3dd2ecd5fcaf30860d5fcfd74edfd70a3dd7603 (patch) | |
tree | a082274e1b04a4363d591f9349466f76ece361fd /misc-utils/logger.c | |
parent | logger: generate header when reading message from stdin (diff) | |
download | kernel-qcow2-util-linux-c3dd2ecd5fcaf30860d5fcfd74edfd70a3dd7603.tar.gz kernel-qcow2-util-linux-c3dd2ecd5fcaf30860d5fcfd74edfd70a3dd7603.tar.xz kernel-qcow2-util-linux-c3dd2ecd5fcaf30860d5fcfd74edfd70a3dd7603.zip |
logger: fix memory leaks
Reported-by: Patrick Plagwitz <patrick.plagwitz@fau.de>
Signed-off-by: Sami Kerola <sami.kerola@lastminute.com>
Diffstat (limited to 'misc-utils/logger.c')
-rw-r--r-- | misc-utils/logger.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/misc-utils/logger.c b/misc-utils/logger.c index 753cd7f99..6316a76fc 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) |