[libvirt] Memory leak in xen_inotify.c

Daniel P. Berrange berrange at redhat.com
Sun Nov 30 18:40:02 UTC 2008


On Sat, Nov 29, 2008 at 01:15:52PM -0800, Niraj Tolia wrote:
> Hi,
> 
> It looks like xenInotifyOpen() in xen_inotify.c has an opendir() call.
> However, as there is no corresponding closedir() and opendir() uses
> malloc internally, valgrind reports this as a memory leak. Adding a
> closedir() to the end of this function should fix this.

Thanks for the bug info, I've committed the following patch:

diff -u -r1.1 xen_inotify.c
--- xen_inotify.c	25 Nov 2008 10:44:53 -0000	1.1
+++ xen_inotify.c	30 Nov 2008 18:36:00 -0000
@@ -395,7 +395,7 @@
                 return -1;
             }
         }
-
+        closedir(dh);
     }
 
     if ((priv->inotifyFD = inotify_init()) < 0) {

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list