From: Daniel P. Berrange Date: Wed, 25 Sep 2013 14:28:55 +0000 (+0100) Subject: Fix leak on OOM in qemuMonitorCommonTestNew X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=92f8c3fc71420765294534f5290c614e8315ecbd;p=libvirt.git Fix leak on OOM in qemuMonitorCommonTestNew Don't leak the path string in qemuMonitorCommonTestNew if an OOM occurs. Signed-off-by: Daniel P. Berrange --- diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 486d72ffb4..763102ce44 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -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;