[PATCH 1/4] libvirtd: avoid memory leak on OOM

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

 



Detected by Coverity; only strikes on OOM so not serious.

* daemon/libvirtd.c (daemonPidFilePath): Plug leak.
---
 daemon/libvirtd.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 60ee705..06d2077 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -310,8 +310,10 @@ daemonPidFilePath(bool privileged,
         if (!(userdir = virGetUserDirectory(geteuid())))
             goto error;

-        if (virAsprintf(pidfile, "%s/.libvirt/libvirtd.pid", userdir) < 0)
+        if (virAsprintf(pidfile, "%s/.libvirt/libvirtd.pid", userdir) < 0) {
+            VIR_FREE(userdir);
             goto no_memory;
+        }

         VIR_FREE(userdir);
     }
-- 
1.7.4.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]