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

Re: [Libguestfs] [PATCH 2/2] virt-format: fix possible memory leak



On 01/31/2012 09:30 PM, Richard W.M. Jones wrote:

> On Tue, Jan 31, 2012 at 06:19:32PM +0800, Wanlong Gao wrote:
>> The strdup/strndup() introduces malloc() to allocate memory,
>> so we need to free them carefully.
> 
> I'm not sure this patch is necessary.
> 
> We already check for memory leaks in many utilities (in 'make
> extra-tests'), but we only do it for the success case.  If the utility
> fails, it's better that it just exits as soon as possible, even if it
> doesn't free all memory along the way.


But I wonder that if fail, where will the allocated memory go? not a leak?

And, when successfully exit, the implied allocated memory is also not freed
here, either.

make extra-tests can test virt-format, too, it seems not?

Thanks
-Wanlong Gao

> 
> Rich.
> 



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