mirror of https://gitee.com/openkylin/qemu.git
net/colo: fix memory double free error
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>
This commit is contained in:
parent
a11f5cb005
commit
0e79668e1f
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue