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

Richard W.M. Jones rjones at redhat.com
Tue Jan 31 13:30:42 UTC 2012


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.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list