]> git.proxmox.com Git - mirror_qemu.git/commitdiff
net/colo: fix memory double free error
authorzhanghailiang <zhang.zhanghailiang@huawei.com>
Tue, 28 Feb 2017 03:54:18 +0000 (11:54 +0800)
committerJason Wang <jasowang@redhat.com>
Mon, 6 Mar 2017 03:46:02 +0000 (11:46 +0800)
The 'primary_list' and 'secondary_list' members of struct Connection
is not allocated through dynamically g_queue_new(), but we free it by using
g_queue_free(), which will lead to a double-free bug.

Reviewed-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
net/colo.c

index 6a6eacd2dc2baaad1b7a976a4e868ff36d203f68..8cc166bc22258368fa2986fdec825f2c9b740d71 100644 (file)
@@ -147,9 +147,9 @@ void connection_destroy(void *opaque)
     Connection *conn = opaque;
 
     g_queue_foreach(&conn->primary_list, packet_destroy, NULL);
-    g_queue_free(&conn->primary_list);
+    g_queue_clear(&conn->primary_list);
     g_queue_foreach(&conn->secondary_list, packet_destroy, NULL);
-    g_queue_free(&conn->secondary_list);
+    g_queue_clear(&conn->secondary_list);
     g_slice_free(Connection, conn);
 }