All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: xen-devel@lists.xen.org
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Ian Campbell <Ian.Campbell@citrix.com>
Subject: [PATCH] tools/libxc: Fix memory leaks in xc_domain_save()
Date: Mon, 24 Jun 2013 16:47:05 +0100	[thread overview]
Message-ID: <6f255399bd674951a104.1372088825@andrewcoop.uk.xensource.com> (raw)

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);

             reply	other threads:[~2013-06-24 15:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-24 15:47 Andrew Cooper [this message]
2013-06-25  9:18 ` [PATCH] tools/libxc: Fix memory leaks in xc_domain_save() George Dunlap
2013-06-26 16:23   ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6f255399bd674951a104.1372088825@andrewcoop.uk.xensource.com \
    --to=andrew.cooper3@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.