From: Ian Jackson Date: Fri, 27 Jan 2012 17:01:19 +0000 (+0000) Subject: xl: fix a couple of memory leaks X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=ab94a40b96b54490140b11b5424eece23585df0c;p=xen.git xl: fix a couple of memory leaks * dolog leaked the log message (!) * main() leaked the config_data (perhaps a false positive from valgrind, but it's nicer to tidy it up). Signed-off-by: Ian Jackson Acked-by: Ian Campbell Committed-by: Ian Jackson --- diff --git a/tools/libxl/xl.c b/tools/libxl/xl.c index 7b9d2c855a..02a680326f 100644 --- a/tools/libxl/xl.c +++ b/tools/libxl/xl.c @@ -135,6 +135,7 @@ int main(int argc, char **argv) config_file, strerror(errno)); parse_global_config(config_file, config_data, config_len); free(config_file); + free(config_data); /* Reset options for per-command use of getopt. */ argv += optind; diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 16fc5bf9b7..5c4dfe3684 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -278,7 +278,7 @@ static void dolog(const char *file, int line, const char *func, char *fmt, ...) static void dolog(const char *file, int line, const char *func, char *fmt, ...) { va_list ap; - char *s; + char *s = NULL; int rc; va_start(ap, fmt); @@ -286,6 +286,7 @@ static void dolog(const char *file, int line, const char *func, char *fmt, ...) va_end(ap); if (rc >= 0) libxl_write_exactly(NULL, logfile, s, rc, NULL, NULL); + free(s); } static void printf_info(int domid,