]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: Fix missing initializer for agent
authorJohn Ferlan <jferlan@redhat.com>
Wed, 2 Mar 2016 00:36:37 +0000 (19:36 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 2 Mar 2016 00:36:37 +0000 (19:36 -0500)
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.

src/util/virpolkit.c

index 3d2be61bba5d6d983e51a4466062b8a37293e048..44f23283035d46150c6db25ce05303ff087305a8 100644 (file)
@@ -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;