qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] qapi: Fix memory leak


From: Laszlo Ersek
Subject: Re: [Qemu-devel] [PATCH] qapi: Fix memory leak
Date: Sun, 19 Aug 2012 12:15:16 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.6esrpre) Gecko/20120714 Thunderbird/10.0.6

On 08/18/12 23:06, Michael Tokarev wrote:
> On 19.08.2012 00:51, Stefan Weil wrote:
> 
>> +++ b/qapi/opts-visitor.c
>> @@ -416,7 +416,7 @@ opts_visitor_cleanup(OptsVisitor *ov)
> 
>>          g_hash_table_destroy(ov->unprocessed_opts);
>>      }
>>      g_free(ov->fake_id_opt);
>> -    memset(ov, '\0', sizeof *ov);
>> +    g_free(ov);
> 
> Shouldn't the function be named opts_visitor_free() or .._destroy()
> in this case?  Or should maybe the caller free "ov" instead of
> this function?  To me it looks like either both free+rename shoud
> be made, or none.

All of

- string-output-visitor.c
- string-input-visitor.c
- qmp-output-visitor.c
- qmp-input-visitor.c
- qapi-dealloc-visitor.c

free the visitor in *_cleanup(). (Which is not to say they shouldn't all
be renamed, only that the patch uni-forms opts-visitor with the rest.)

Thanks,
Laszlo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]