aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc
diff options
context:
space:
mode:
authorAndrew Cooper <andrew.cooper3@citrix.com>2013-06-24 16:47:05 +0100
committerIan Campbell <ian.campbell@citrix.com>2013-06-26 17:22:41 +0100
commitb53f25e319d2d862b889260ccff6c8baea664a21 (patch)
tree63b3af2b7b63131c7fe0b31e7a102b5ad36f8a0c /tools/libxc
parentde6562b4df1bce0a57bcd7cc09fc4ec494077444 (diff)
downloadxen-b53f25e319d2d862b889260ccff6c8baea664a21.tar.gz
xen-b53f25e319d2d862b889260ccff6c8baea664a21.tar.bz2
xen-b53f25e319d2d862b889260ccff6c8baea664a21.zip
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@citrix.com> Acked-by: George Dunlap <george.dunlap@eu.citrix.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/libxc')
-rw-r--r--tools/libxc/xc_domain_save.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c
index ff766265df..fbc15e9488 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);