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>
This commit is contained in:
parent
7692401a08
commit
672558d2ea
3
numa.c
3
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)
|
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,
|
* 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
range = g_malloc0(sizeof(*range));
|
||||||
range->mem_start = addr;
|
range->mem_start = addr;
|
||||||
range->mem_end = addr + size - 1;
|
range->mem_end = addr + size - 1;
|
||||||
QLIST_INSERT_HEAD(&numa_info[node].addr, range, entry);
|
QLIST_INSERT_HEAD(&numa_info[node].addr, range, entry);
|
||||||
|
|
Loading…
Reference in New Issue