[PATCH] util: Cleanup error path for virPolkitAgentCreate

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

 



More fallout from changing to using virPolkitAgent and handling error
paths.  Needed to clear the 'cmd' once stored and of course add the
virCommandFree(cmd) in the error: label.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---

Found by coverity...
Pushed as trivial...

 src/util/virpolkit.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/util/virpolkit.c b/src/util/virpolkit.c
index 44f2328..2038744 100644
--- a/src/util/virpolkit.c
+++ b/src/util/virpolkit.c
@@ -182,6 +182,7 @@ virPolkitAgentCreate(void)
     if (VIR_ALLOC(agent) < 0)
         goto error;
     agent->cmd = cmd;
+    cmd = NULL;
 
     virCommandAddArgFormat(cmd, "%lld", (long long int) getpid());
     virCommandAddArg(cmd, "--notify-fd");
@@ -206,6 +207,7 @@ virPolkitAgentCreate(void)
     VIR_FORCE_CLOSE(pipe_fd[0]);
     VIR_FORCE_CLOSE(pipe_fd[1]);
     virPolkitAgentDestroy(agent);
+    virCommandFree(cmd);
     return NULL;
 }
 
-- 
2.5.0

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