diff options
author | Bharata B Rao <bharata@linux.vnet.ibm.com> | 2015-07-09 20:57:36 +0530 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2015-07-15 16:57:50 -0300 |
commit | 672558d2ea8dd782d1d2adc6e16af3bc34029a36 (patch) | |
tree | 9f44d41ff26cce480db1a062a473df8cf2465406 | |
parent | 7692401a0826803522cfde533bdcc149932ddc6a (diff) |
numa: Fix memory leak in numa_set_mem_node_id()
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>
-rw-r--r-- | numa.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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); |