[PATCH 02/10] libvirtd: avoid leak on failure

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

 



Spotted by Coverity.  Only possible on an OOM condition, so
unlikely to bite in the wild.

* daemon/libvirtd.c (qemudSetLogging): Don't leak memory.
---
 daemon/libvirtd.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index aec81cf..728031f 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -2779,8 +2779,10 @@ qemudSetLogging(struct qemud_server *server, virConfPtr conf,
                     goto free_and_fail;

                 if (virAsprintf(&tmp, "%d:file:%s/.libvirt/libvirtd.log",
-                                virLogGetDefaultPriority(), userdir) == -1)
+                                virLogGetDefaultPriority(), userdir) == -1) {
+                    VIR_FREE(userdir);
                     goto out_of_memory;
+                }
             }
         } else {
             if (virAsprintf(&tmp, "%d:stderr", virLogGetDefaultPriority()) < 0)
-- 
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]