[Qemu-devel] [PATCH V2] net/colo-compare: Fix memory free error

Zhang Chen posted 1 patch 7 years, 2 months ago
Failed in applying to current master (apply log)
net/colo-compare.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[Qemu-devel] [PATCH V2] net/colo-compare: Fix memory free error
Posted by Zhang Chen 7 years, 2 months ago
We use g_queue_init() to init s->conn_list, so we should use g_queue_clear()
to instead of g_queue_free().

Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
Reviewed-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
---
 net/colo-compare.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/colo-compare.c b/net/colo-compare.c
index a6fc2ff..300f017 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -729,7 +729,7 @@ static void colo_compare_finalize(Object *obj)
     /* Release all unhandled packets after compare thead exited */
     g_queue_foreach(&s->conn_list, colo_flush_packets, s);
 
-    g_queue_free(&s->conn_list);
+    g_queue_clear(&s->conn_list);
 
     g_hash_table_destroy(s->connection_track_table);
     g_free(s->pri_indev);
-- 
2.7.4




Re: [Qemu-devel] [PATCH V2] net/colo-compare: Fix memory free error
Posted by Jason Wang 7 years, 2 months ago

On 2017年02月22日 13:16, Zhang Chen wrote:
> We use g_queue_init() to init s->conn_list, so we should use g_queue_clear()
> to instead of g_queue_free().
>
> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
> Reviewed-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
> ---
>   net/colo-compare.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

>
> diff --git a/net/colo-compare.c b/net/colo-compare.c
> index a6fc2ff..300f017 100644
> --- a/net/colo-compare.c
> +++ b/net/colo-compare.c
> @@ -729,7 +729,7 @@ static void colo_compare_finalize(Object *obj)
>       /* Release all unhandled packets after compare thead exited */
>       g_queue_foreach(&s->conn_list, colo_flush_packets, s);
>   
> -    g_queue_free(&s->conn_list);
> +    g_queue_clear(&s->conn_list);
>   
>       g_hash_table_destroy(s->connection_track_table);
>       g_free(s->pri_indev);