Commit b0e90181 authored by Chen Fan's avatar Chen Fan Committed by Michael Tokarev

query-memdev: fix potential memory leaks

Signed-off-by: default avatarChen Fan <chen.fan.fnst@cn.fujitsu.com>
Reviewed-by: default avatarPeter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: default avatarHu Tao <hutao@cn.fujitsu.com>
Signed-off-by: default avatarMichael Tokarev <mjt@tls.msk.ru>
parent 622fb504
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment