Commit 34d5e948e8a0d0d3a37801a418475a8632ce0891

Authored by Isaku Yamahata
Committed by Anthony Liguori
1 parent 7677f05d

cpu_unregister_map_client: fix memory leak.

fix memory leak in cpu_unregister_map_client() and cpu_notify_map_clients().

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing 1 changed file with 2 additions and 1 deletions
@@ -3281,6 +3281,7 @@ void cpu_unregister_map_client(void *_client) @@ -3281,6 +3281,7 @@ void cpu_unregister_map_client(void *_client)
3281 MapClient *client = (MapClient *)_client; 3281 MapClient *client = (MapClient *)_client;
3282 3282
3283 LIST_REMOVE(client, link); 3283 LIST_REMOVE(client, link);
  3284 + qemu_free(client);
3284 } 3285 }
3285 3286
3286 static void cpu_notify_map_clients(void) 3287 static void cpu_notify_map_clients(void)
@@ -3290,7 +3291,7 @@ static void cpu_notify_map_clients(void) @@ -3290,7 +3291,7 @@ static void cpu_notify_map_clients(void)
3290 while (!LIST_EMPTY(&map_client_list)) { 3291 while (!LIST_EMPTY(&map_client_list)) {
3291 client = LIST_FIRST(&map_client_list); 3292 client = LIST_FIRST(&map_client_list);
3292 client->callback(client->opaque); 3293 client->callback(client->opaque);
3293 - LIST_REMOVE(client, link); 3294 + cpu_unregister_map_client(client);
3294 } 3295 }
3295 } 3296 }
3296 3297