The config object is refed but unrefed only on error which leaves refcount unbalanced on successful return. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> --- src/lxc/lxc_process.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index 3e44da1aaf..d021a890f7 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -931,7 +931,7 @@ virLXCProcessBuildControllerCmd(virLXCDriverPtr driver, filterstr = virLogGetFilters(); if (!filterstr) { virReportOOMError(); - goto cleanup; + goto error; } virCommandAddEnvPair(cmd, "LIBVIRT_LOG_FILTERS", filterstr); @@ -943,7 +943,7 @@ virLXCProcessBuildControllerCmd(virLXCDriverPtr driver, outputstr = virLogGetOutputs(); if (!outputstr) { virReportOOMError(); - goto cleanup; + goto error; } virCommandAddEnvPair(cmd, "LIBVIRT_LOG_OUTPUTS", outputstr); @@ -973,7 +973,7 @@ virLXCProcessBuildControllerCmd(virLXCDriverPtr driver, char *tmp = NULL; if (virAsprintf(&tmp, "--share-%s", nsInfoLocal[i]) < 0) - goto cleanup; + goto error; virCommandAddArg(cmd, tmp); virCommandAddArgFormat(cmd, "%d", nsInheritFDs[i]); virCommandPassFD(cmd, nsInheritFDs[i], 0); @@ -999,11 +999,13 @@ virLXCProcessBuildControllerCmd(virLXCDriverPtr driver, * write the live domain status XML with the PID */ virCommandRequireHandshake(cmd); + cleanup: + virObjectUnref(cfg); return cmd; - cleanup: + error: virCommandFree(cmd); - virObjectUnref(cfg); - return NULL; + cmd = NULL; + goto cleanup; } -- 2.16.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list