[libvirt] [PATCH] util: Fix missing initializer for agent

John Ferlan jferlan at redhat.com
Wed Mar 2 00:39:33 UTC 2016


In virPolkitAgentCreate neglected to initialize agent to NULL. If
there was an error in the pipe, then we jump to error and would have
an issue. Found by coverity.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---

Pushing as trivial

 src/util/virpolkit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/virpolkit.c b/src/util/virpolkit.c
index 3d2be61..44f2328 100644
--- a/src/util/virpolkit.c
+++ b/src/util/virpolkit.c
@@ -166,7 +166,7 @@ virPolkitAgentDestroy(virPolkitAgentPtr agent)
 virPolkitAgentPtr
 virPolkitAgentCreate(void)
 {
-    virPolkitAgentPtr agent;
+    virPolkitAgentPtr agent = NULL;
     virCommandPtr cmd = virCommandNewArgList(PKTTYAGENT, "--process", NULL);
     int pipe_fd[2] = {-1, -1};
     struct pollfd pollfd;
-- 
2.5.0




More information about the libvir-list mailing list