[PATCH 16/23] Fix leak on OOM in qemuMonitorCommonTestNew

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

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

Don't leak the path string in qemuMonitorCommonTestNew if
an OOM occurs.

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 tests/qemumonitortestutils.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index 486d72f..763102c 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -793,6 +793,7 @@ qemuMonitorCommonTestNew(virDomainXMLOptionPtr xmlopt,
     src->type = VIR_DOMAIN_CHR_TYPE_UNIX;
     src->data.nix.path = (char *)path;
     src->data.nix.listen = false;
+    path = NULL;
 
     if (virNetSocketListen(test->server, 1) < 0)
         goto error;
@@ -801,6 +802,7 @@ cleanup:
     return test;
 
 error:
+    VIR_FREE(path);
     VIR_FREE(tmpdir_template);
     qemuMonitorTestFree(test);
     test = NULL;
-- 
1.8.3.1

--
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]