mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-24 03:59:52 +00:00
query-memdev: fix potential memory leaks
Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Reviewed-by: Hu Tao <hutao@cn.fujitsu.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
parent
622fb504c4
commit
b0e90181e4
6
numa.c
6
numa.c
@ -318,10 +318,11 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner,
|
||||
static int query_memdev(Object *obj, void *opaque)
|
||||
{
|
||||
MemdevList **list = opaque;
|
||||
MemdevList *m = NULL;
|
||||
Error *err = NULL;
|
||||
|
||||
if (object_dynamic_cast(obj, TYPE_MEMORY_BACKEND)) {
|
||||
MemdevList *m = g_malloc0(sizeof(*m));
|
||||
m = g_malloc0(sizeof(*m));
|
||||
|
||||
m->value = g_malloc0(sizeof(*m->value));
|
||||
|
||||
@ -369,6 +370,9 @@ static int query_memdev(Object *obj, void *opaque)
|
||||
|
||||
return 0;
|
||||
error:
|
||||
g_free(m->value);
|
||||
g_free(m);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user