Re: [PATCH] Free the return value of virFileFindResource

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

 



On Mon, Jul 07, 2014 at 08:33:37AM +0200, Ján Tomko wrote:
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


Would this compile on windows without warning if this free was ran
unconditionally and the conditional around its declaration was removed
as well?

ACK either way,

Martin

Attachment: signature.asc
Description: Digital signature

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