]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix leak on OOM in qemuMonitorCommonTestNew
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 25 Sep 2013 14:28:55 +0000 (15:28 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 25 Sep 2013 17:12:09 +0000 (18:12 +0100)
Don't leak the path string in qemuMonitorCommonTestNew if
an OOM occurs.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
tests/qemumonitortestutils.c

index 486d72ffb4d0748b46ab905664a5d90c5726b39e..763102ce4447c41c6ab9be081d3704f1d65dc2ec 100644 (file)
@@ -793,6 +793,7 @@ qemuMonitorCommonTestNew(virDomainXMLOptionPtr xmlopt,
     src->type = VIR_DOMAIN_CHR_TYPE_UNIX;
     src->data.nix.path = (char *)path;
     src->data.nix.listen = false;
+    path = NULL;
 
     if (virNetSocketListen(test->server, 1) < 0)
         goto error;
@@ -801,6 +802,7 @@ cleanup:
     return test;
 
 error:
+    VIR_FREE(path);
     VIR_FREE(tmpdir_template);
     qemuMonitorTestFree(test);
     test = NULL;