[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xl: fix a couple of memory leaks



# HG changeset patch
# User Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
# Date 1327683679 0
# Node ID f204ead7d9e4904beb7a848860b23780b480ed6c
# Parent  097f5d9c32f975464462a11644177ce8b6b6e9e7
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 <ian.jackson@xxxxxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Committed-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---


diff -r 097f5d9c32f9 -r f204ead7d9e4 tools/libxl/xl.c
--- a/tools/libxl/xl.c  Fri Jan 27 17:01:18 2012 +0000
+++ b/tools/libxl/xl.c  Fri Jan 27 17:01:19 2012 +0000
@@ -135,6 +135,7 @@
                 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 -r 097f5d9c32f9 -r f204ead7d9e4 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Fri Jan 27 17:01:18 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Fri Jan 27 17:01:19 2012 +0000
@@ -278,7 +278,7 @@
 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 @@
     va_end(ap);
     if (rc >= 0)
         libxl_write_exactly(NULL, logfile, s, rc, NULL, NULL);
+    free(s);
 }
 
 static void printf_info(int domid,

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.