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

Zhang Chen posted 1 patch 7 years, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/1487645041-28919-1-git-send-email-zhangchen.fnst@cn.fujitsu.com
Test checkpatch passed
Test docker passed
Test s390x passed
There is a newer version of this series
net/colo-compare.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[Qemu-devel] [PATCH] net/colo-compare: Fix memory free error
Posted by Zhang Chen 7 years, 1 month 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>
---
 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 162fd6a..cf8c4c9 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -715,7 +715,7 @@ static void colo_compare_finalize(Object *obj)
     qemu_chr_fe_deinit(&s->chr_sec_in);
     qemu_chr_fe_deinit(&s->chr_out);
 
-    g_queue_free(&s->conn_list);
+    g_queue_clear(&s->conn_list);
 
     if (qemu_thread_is_self(&s->thread)) {
         /* compare connection */
-- 
2.7.4




Re: [Qemu-devel] [PATCH] net/colo-compare: Fix memory free error
Posted by Hailiang Zhang 7 years, 1 month ago
On 2017/2/21 10:44, 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(-)
>
> diff --git a/net/colo-compare.c b/net/colo-compare.c
> index 162fd6a..cf8c4c9 100644
> --- a/net/colo-compare.c
> +++ b/net/colo-compare.c
> @@ -715,7 +715,7 @@ static void colo_compare_finalize(Object *obj)
>       qemu_chr_fe_deinit(&s->chr_sec_in);
>       qemu_chr_fe_deinit(&s->chr_out);
>
> -    g_queue_free(&s->conn_list);
> +    g_queue_clear(&s->conn_list);
>
>       if (qemu_thread_is_self(&s->thread)) {
>           /* compare connection */
>


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

On 2017年02月22日 09:47, Hailiang Zhang wrote:
> On 2017/2/21 10:44, 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>
>

Applied, thanks.

>> ---
>>   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 162fd6a..cf8c4c9 100644
>> --- a/net/colo-compare.c
>> +++ b/net/colo-compare.c
>> @@ -715,7 +715,7 @@ static void colo_compare_finalize(Object *obj)
>>       qemu_chr_fe_deinit(&s->chr_sec_in);
>>       qemu_chr_fe_deinit(&s->chr_out);
>>
>> -    g_queue_free(&s->conn_list);
>> +    g_queue_clear(&s->conn_list);
>>
>>       if (qemu_thread_is_self(&s->thread)) {
>>           /* compare connection */
>>
>


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

On 2017年02月22日 11:09, Jason Wang wrote:
>
>
> On 2017年02月22日 09:47, Hailiang Zhang wrote:
>> On 2017/2/21 10:44, 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>
>>
>
> Applied, thanks.

Actually reverted. The patch does not apply cleanly on -net.

Please re-send the patch on top of https://github.com/jasowang/qemu.git net

Thanks

>
>>> ---
>>>   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 162fd6a..cf8c4c9 100644
>>> --- a/net/colo-compare.c
>>> +++ b/net/colo-compare.c
>>> @@ -715,7 +715,7 @@ static void colo_compare_finalize(Object *obj)
>>>       qemu_chr_fe_deinit(&s->chr_sec_in);
>>>       qemu_chr_fe_deinit(&s->chr_out);
>>>
>>> -    g_queue_free(&s->conn_list);
>>> +    g_queue_clear(&s->conn_list);
>>>
>>>       if (qemu_thread_is_self(&s->thread)) {
>>>           /* compare connection */
>>>
>>
>
>


Re: [Qemu-devel] [PATCH] net/colo-compare: Fix memory free error
Posted by Zhang Chen 7 years, 1 month ago

On 02/22/2017 11:15 AM, Jason Wang wrote:
>
>
> On 2017年02月22日 11:09, Jason Wang wrote:
>>
>>
>> On 2017年02月22日 09:47, Hailiang Zhang wrote:
>>> On 2017/2/21 10:44, 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>
>>>
>>
>> Applied, thanks.
>
> Actually reverted. The patch does not apply cleanly on -net.
>
> Please re-send the patch on top of 
> https://github.com/jasowang/qemu.git net

OK~~

Thanks
Zhang Chen

>
> Thanks
>
>>
>>>> ---
>>>>   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 162fd6a..cf8c4c9 100644
>>>> --- a/net/colo-compare.c
>>>> +++ b/net/colo-compare.c
>>>> @@ -715,7 +715,7 @@ static void colo_compare_finalize(Object *obj)
>>>>       qemu_chr_fe_deinit(&s->chr_sec_in);
>>>>       qemu_chr_fe_deinit(&s->chr_out);
>>>>
>>>> -    g_queue_free(&s->conn_list);
>>>> +    g_queue_clear(&s->conn_list);
>>>>
>>>>       if (qemu_thread_is_self(&s->thread)) {
>>>>           /* compare connection */
>>>>
>>>
>>
>>
>
>
>
> .
>

-- 
Thanks
Zhang Chen