[libvirt] [PATCH] Free the return value of virFileFindResource

Ján Tomko jtomko at redhat.com
Mon Jul 7 06:33:37 UTC 2014


Commits e18a80a and 57e5c3c switched from a getenv wrapper which
does not allocate a string to virFileFindResource which does not,
without freeing it.

https://bugzilla.redhat.com/show_bug.cgi?id=1116427
---
 src/locking/lock_driver_lockd.c | 2 ++
 src/remote/remote_driver.c      | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/src/locking/lock_driver_lockd.c b/src/locking/lock_driver_lockd.c
index c67bda6..1ca7772 100644
--- a/src/locking/lock_driver_lockd.c
+++ b/src/locking/lock_driver_lockd.c
@@ -273,11 +273,13 @@ static virNetClientPtr virLockManagerLockDaemonConnectionNew(bool privileged,
     if (virNetClientAddProgram(client, *prog) < 0)
         goto error;
 
+    VIR_FREE(daemonPath);
     VIR_FREE(lockdpath);
 
     return client;
 
  error:
+    VIR_FREE(daemonPath);
     VIR_FREE(lockdpath);
     virNetClientClose(client);
     virObjectUnref(client);
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 88fc977..9d8120f 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -1068,6 +1068,9 @@ doRemoteOpen(virConnectPtr conn,
     VIR_FREE(pkipath);
     VIR_FREE(knownHostsVerify);
     VIR_FREE(knownHosts);
+#ifndef WIN32
+    VIR_FREE(daemonPath);
+#endif
 
     return retcode;
 
-- 
1.8.5.5




More information about the libvir-list mailing list