Andrew Cooper
2013-Jun-24 15:47 UTC
[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@citrix.com>
--
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);
George Dunlap
2013-Jun-25 09:18 UTC
Re: [PATCH] tools/libxc: Fix memory leaks in xc_domain_save()
On 06/24/2013 04:47 PM, Andrew Cooper wrote:> Introduces outbuf_free() to mirror the currently existing outbuf_init(). > > Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>Both re the release and the content: Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Ian Campbell
2013-Jun-26 16:23 UTC
Re: [PATCH] tools/libxc: Fix memory leaks in xc_domain_save()
On Tue, 2013-06-25 at 10:18 +0100, George Dunlap wrote:> On 06/24/2013 04:47 PM, Andrew Cooper wrote: > > Introduces outbuf_free() to mirror the currently existing outbuf_init(). > > > > Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> > > Both re the release and the content: > > Acked-by: George Dunlap <george.dunlap@eu.citrix.com>Acked + applied to unstable.