[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 1/1] numa: Fix memory leak in numa_set_mem_node_id()
From: |
Eduardo Habkost |
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 |
From: Bharata B Rao <address@hidden>
Fix a memory leak in numa_set_mem_node_id().
Signed-off-by: Bharata B Rao <address@hidden>
Reported-by: Paolo Bonzini <address@hidden>
Reviewed-by: Eduardo Habkost <address@hidden>
Signed-off-by: Eduardo Habkost <address@hidden>
---
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