qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, Bharata B Rao <bharata@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PULL 1/1] numa: Fix memory leak in numa_set_mem_node_id()
Date: Wed, 15 Jul 2015 17:02:02 -0300	[thread overview]
Message-ID: <1436990522-22700-2-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1436990522-22700-1-git-send-email-ehabkost@redhat.com>

From: Bharata B Rao <bharata@linux.vnet.ibm.com>

Fix a memory leak in numa_set_mem_node_id().

Signed-off-by: Bharata B Rao <bharata@linux.vnet.com>
Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 numa.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/numa.c b/numa.c
index 3c80059..402804b 100644
--- a/numa.c
+++ b/numa.c
@@ -54,7 +54,7 @@ NodeInfo numa_info[MAX_NODES];
 
 void numa_set_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t node)
 {
-    struct numa_addr_range *range = g_malloc0(sizeof(*range));
+    struct numa_addr_range *range;
 
     /*
      * Memory-less nodes can come here with 0 size in which case,
@@ -64,6 +64,7 @@ void numa_set_mem_node_id(ram_addr_t addr, uint64_t size, uint32_t node)
         return;
     }
 
+    range = g_malloc0(sizeof(*range));
     range->mem_start = addr;
     range->mem_end = addr + size - 1;
     QLIST_INSERT_HEAD(&numa_info[node].addr, range, entry);
-- 
2.1.0

  reply	other threads:[~2015-07-15 20:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-15 20:02 [Qemu-devel] [PULL 0/1] NUMA queue, 2015-07-15 Eduardo Habkost
2015-07-15 20:02 ` Eduardo Habkost [this message]
2015-07-15 21:04 ` Peter Maydell

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=1436990522-22700-2-git-send-email-ehabkost@redhat.com \
    --to=ehabkost@redhat.com \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).