]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: Cleanup error path for virPolkitAgentCreate
authorJohn Ferlan <jferlan@redhat.com>
Wed, 2 Mar 2016 18:59:37 +0000 (13:59 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 2 Mar 2016 18:59:37 +0000 (13:59 -0500)
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.

src/util/virpolkit.c

index 44f23283035d46150c6db25ce05303ff087305a8..203874440439646398dea55e8034202066071c91 100644 (file)
@@ -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;
 }