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

Re: [libvirt] [PATCHv2] daemon: Plug memory leaks



On Thu, Apr 12, 2012 at 05:12:12PM +0800, Alex Jia wrote:
> * daemon/libvirtd-config.c (daemonConfigFree): fix memory leaks.
> 
> How to reproduce?
> 
> % make && make -C tests check TESTS=libvirtdconftest
> % cd tests && valgrind -v --leak-check=full ./libvirtdconftest
> 
> actual result:
> 
> ==11008== 185 bytes in 5 blocks are definitely lost in loss record 3 of 5
> ==11008==    at 0x4A05FDE: malloc (vg_replace_malloc.c:236)
> ==11008==    by 0x39CF07F6E1: strdup (strdup.c:43)
> ==11008==    by 0x406626: daemonConfigLoadOptions (libvirtd-config.c:438)
> ==11008==    by 0x406800: daemonConfigLoadData (libvirtd-config.c:492)
> ==11008==    by 0x403CCF: testCorrupt (libvirtdconftest.c:110)
> ==11008==    by 0x404FAD: virtTestRun (testutils.c:145)
> ==11008==    by 0x403A34: mymain (libvirtdconftest.c:219)
> ==11008==    by 0x404687: virtTestMain (testutils.c:700)
> ==11008==    by 0x39CF01ECDC: (below main) (libc-start.c:226)
> ==11008==
> ==11008== LEAK SUMMARY:
> ==11008==    definitely lost: 185 bytes in 5 blocks
> 
> Signed-off-by: Alex Jia <ajia redhat com>
> ---
>  daemon/libvirtd-config.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/daemon/libvirtd-config.c b/daemon/libvirtd-config.c
> index 4d041f0..471236c 100644
> --- a/daemon/libvirtd-config.c
> +++ b/daemon/libvirtd-config.c
> @@ -358,6 +358,7 @@ daemonConfigFree(struct daemonConfig *data)
>      VIR_FREE(data->cert_file);
>      VIR_FREE(data->crl_file);
>  
> +    VIR_FREE(data->host_uuid);
>      VIR_FREE(data->log_filters);
>      VIR_FREE(data->log_outputs);

ACK

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


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