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

[Xen-changelog] [xen master] tools/libxc: Fix memory leaks in xc_domain_save()



commit b53f25e319d2d862b889260ccff6c8baea664a21
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Mon Jun 24 16:47:05 2013 +0100
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Wed Jun 26 17:22:41 2013 +0100

    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>
    Acked-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/libxc/xc_domain_save.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c
index ff76626..fbc15e9 100644
--- 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, struct outbuf* 
ob, size_t size)
     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, int io_fd, uint32_t 
dom, uint32_t max_iter
     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);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
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®.