diff mbox

Avoid memory leak

Message ID 1448501448-5652-1-git-send-email-opensource.dxs@aliyun.com
State New
Headers show

Commit Message

dongxingshui Nov. 26, 2015, 1:30 a.m. UTC
monitor.c: Avoid memory leak

When send a wrong qmp command, a memory leak occurs. Fix it.

Signed-off-by: dongxingshui <opensource.dxs@aliyun.com>
---
 monitor.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Eric Blake Nov. 26, 2015, 3:43 a.m. UTC | #1
On 11/25/2015 06:30 PM, dongxingshui wrote:
> monitor.c: Avoid memory leak
> 
> When send a wrong qmp command, a memory leak occurs. Fix it.

Looks like the leak was introduced in 710aec9; would be worth amending
the commit message to mention that.

Reviewed-by: Eric Blake <eblake@redhat.com>

> 
> Signed-off-by: dongxingshui <opensource.dxs@aliyun.com>

This looks like your first patch to qemu (at least I wasn't able to find
anything from you via 'git log') - welcome to the community.  I suspect
that 'dongxingshui' is probably your login name; it doesn't give a
Western reader like me an idea where to break into family and personal
names.  It's a bit nicer to use a 'Full Name' notation, or even to list
your name in two forms (Latin and native UTF-8 characters); see this
recent conversation:

https://lists.gnu.org/archive/html/qemu-devel/2015-11/msg05208.html

> ---
>  monitor.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/monitor.c b/monitor.c
> index e4cf34e..af6cfc5 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -3906,6 +3906,7 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
>  
>  err_out:
>      monitor_protocol_emitter(mon, data, local_err);
> +    error_free(local_err);
>      qobject_decref(data);
>      QDECREF(input);
>      QDECREF(args);
>
Markus Armbruster Nov. 26, 2015, 7:40 a.m. UTC | #2
dongxingshui <opensource.dxs@aliyun.com> writes:

> monitor.c: Avoid memory leak
>
> When send a wrong qmp command, a memory leak occurs. Fix it.
>
> Signed-off-by: dongxingshui <opensource.dxs@aliyun.com>

Functionally the same as
http://lists.gnu.org/archive/html/qemu-devel/2015-10/msg06862.html
Message-Id: <1446117309-15322-1-git-send-email-armbru@redhat.com>

The delay getting that merged is entirely my fault.  Thanks!
dongxingshui Nov. 26, 2015, 8:38 a.m. UTC | #3
On 2015/11/26 11:43, Eric Blake wrote:
> On 11/25/2015 06:30 PM, dongxingshui wrote:
>> monitor.c: Avoid memory leak
>>
>> When send a wrong qmp command, a memory leak occurs. Fix it.
> 
> Looks like the leak was introduced in 710aec9; would be worth amending
> the commit message to mention that.

Sorry! I didn't see the mailing list before. It has been fixed by Markus.

> 
> Reviewed-by: Eric Blake <eblake@redhat.com>
> 
>>
>> Signed-off-by: dongxingshui <opensource.dxs@aliyun.com>
> 
> This looks like your first patch to qemu (at least I wasn't able to find
> anything from you via 'git log') - welcome to the community.  I suspect
> that 'dongxingshui' is probably your login name; it doesn't give a
> Western reader like me an idea where to break into family and personal
> names.  It's a bit nicer to use a 'Full Name' notation, or even to list
> your name in two forms (Latin and native UTF-8 characters); see this
> recent conversation:

I'm pleased to join the community.
Thank you for your suggestion, i'll change my signed-off message and use the following one.
Signed-off-by: Stefano Dong (董兴水) <opensource.dxs@aliyun.com>


> 
> https://lists.gnu.org/archive/html/qemu-devel/2015-11/msg05208.html
> 
>> ---
>>  monitor.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/monitor.c b/monitor.c
>> index e4cf34e..af6cfc5 100644
>> --- a/monitor.c
>> +++ b/monitor.c
>> @@ -3906,6 +3906,7 @@ static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
>>  
>>  err_out:
>>      monitor_protocol_emitter(mon, data, local_err);
>> +    error_free(local_err);
>>      qobject_decref(data);
>>      QDECREF(input);
>>      QDECREF(args);
>>
>
Markus Armbruster Nov. 26, 2015, 8:52 a.m. UTC | #4
stefano <opensource.dxs@aliyun.com> writes:

> On 2015/11/26 11:43, Eric Blake wrote:
>> On 11/25/2015 06:30 PM, dongxingshui wrote:
>>> monitor.c: Avoid memory leak
>>>
>>> When send a wrong qmp command, a memory leak occurs. Fix it.
>> 
>> Looks like the leak was introduced in 710aec9; would be worth amending
>> the commit message to mention that.
>
> Sorry! I didn't see the mailing list before. It has been fixed by Markus.
>
>> 
>> Reviewed-by: Eric Blake <eblake@redhat.com>
>> 
>>>
>>> Signed-off-by: dongxingshui <opensource.dxs@aliyun.com>
>> 
>> This looks like your first patch to qemu (at least I wasn't able to find
>> anything from you via 'git log') - welcome to the community.  I suspect
>> that 'dongxingshui' is probably your login name; it doesn't give a
>> Western reader like me an idea where to break into family and personal
>> names.  It's a bit nicer to use a 'Full Name' notation, or even to list
>> your name in two forms (Latin and native UTF-8 characters); see this
>> recent conversation:
>
> I'm pleased to join the community.
> Thank you for your suggestion, i'll change my signed-off message and
> use the following one.
> Signed-off-by: Stefano Dong (董兴水) <opensource.dxs@aliyun.com>

Looks good.  Welcome!
diff mbox

Patch

diff --git a/monitor.c b/monitor.c
index e4cf34e..af6cfc5 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3906,6 +3906,7 @@  static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
 
 err_out:
     monitor_protocol_emitter(mon, data, local_err);
+    error_free(local_err);
     qobject_decref(data);
     QDECREF(input);
     QDECREF(args);