From: Daniel P. Berrange Date: Thu, 3 Dec 2015 17:24:10 +0000 (+0000) Subject: qemu: fix memory leak in opening log file X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=0eafe9955bfde5b3b9bc1805c5a8ed045b35fe53;p=people%2Fliuw%2Flibxenctrl-split%2Flibvirt.git qemu: fix memory leak in opening log file The qemuDomainLogContextNew method leaks the "logfile" path on the non-virtlogd code path. Signed-off-by: Daniel P. Berrange --- diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index a87259896..d60cf73a2 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2360,13 +2360,15 @@ qemuDomainLogContextPtr qemuDomainLogContextNew(virQEMUDriverPtr driver, } } + cleanup: virObjectUnref(cfg); + VIR_FREE(logfile); return ctxt; error: - virObjectUnref(cfg); qemuDomainLogContextFree(ctxt); - return NULL; + ctxt = NULL; + goto cleanup; }