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

[Xen-devel] [PATCH] tools/libxc: Fix memory leaks in xc_domain_save()



Introduces outbuf_free() to mirror the currently existing outbuf_init().

Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

--
George: Same comment regarding consideration for 4.3

Ian: This should be considered for backporting to 4.2 and 4.1 as well

diff -r 803ad8977a81 -r 6f255399bd67 tools/libxc/xc_domain_save.c
--- a/tools/libxc/xc_domain_save.c
+++ b/tools/libxc/xc_domain_save.c
@@ -139,6 +139,13 @@ static int outbuf_init(xc_interface *xch
     return 0;
 }
 
+static int outbuf_free(struct outbuf *ob)
+{
+    free(ob->buf);
+    ob->buf = NULL;
+    return 0;
+}
+
 static inline int outbuf_write(xc_interface *xch,
                                struct outbuf* ob, void* buf, size_t len)
 {
@@ -2122,6 +2129,8 @@ int xc_domain_save(xc_interface *xch, in
     free(pfn_batch);
     free(pfn_err);
     free(to_fix);
+    free(hvm_buf);
+    outbuf_free(&ob_pagebuf);
 
     DPRINTF("Save exit of domid %u with rc=%d\n", dom, rc);
 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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