Fix a memory leak due to wrong free order
This commit is contained in:
@ -786,12 +786,23 @@ static void address_space_update_topology_pass(AddressSpace *as,
|
||||
|
||||
static void flatviews_init(struct uc_struct *uc)
|
||||
{
|
||||
static FlatView *empty_view;
|
||||
|
||||
if (uc->flat_views) {
|
||||
return;
|
||||
}
|
||||
|
||||
uc->flat_views = g_hash_table_new_full(NULL, NULL, NULL,
|
||||
(GDestroyNotify) flatview_unref);
|
||||
|
||||
if (!empty_view) {
|
||||
empty_view = generate_memory_topology(uc, NULL);
|
||||
/* We keep it alive forever in the global variable. */
|
||||
flatview_ref(empty_view);
|
||||
} else {
|
||||
g_hash_table_replace(uc->flat_views, NULL, empty_view);
|
||||
flatview_ref(empty_view);
|
||||
}
|
||||
}
|
||||
|
||||
static void flatviews_reset(struct uc_struct *uc)
|
||||
|
Reference in New Issue
Block a user