From: Peter Krempa Date: Thu, 4 Feb 2021 14:12:57 +0000 (+0100) Subject: qemuNamespaceUnlinkPaths: Fix inconsistent cleanup handling X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=b020663381bfa95976fa50c739185e10e5c3c45f;p=libvirt.git qemuNamespaceUnlinkPaths: Fix inconsistent cleanup handling Some code paths return -1 directly while others jump to 'cleanup' which cleans the list of mounts. Since qemuDomainGetPreservedMounts now returns a NULL-terminated list, convert devMountsPath to g_auto(GStrv) and remove the cleanup altoghether. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c index 03cc6379fe..af08b3e055 100644 --- a/src/qemu/qemu_namespace.c +++ b/src/qemu/qemu_namespace.c @@ -1341,11 +1341,9 @@ qemuNamespaceUnlinkPaths(virDomainObjPtr vm, virQEMUDriverPtr driver = priv->driver; g_autoptr(virQEMUDriverConfig) cfg = NULL; g_auto(GStrv) unlinkPaths = NULL; - char **devMountsPath = NULL; - size_t ndevMountsPath = 0; + g_auto(GStrv) devMountsPath = NULL; size_t npaths; size_t i; - int ret = -1; npaths = virStringListLength(paths); if (!npaths) @@ -1353,10 +1351,8 @@ qemuNamespaceUnlinkPaths(virDomainObjPtr vm, cfg = virQEMUDriverGetConfig(driver); - if (qemuDomainGetPreservedMounts(cfg, vm, - &devMountsPath, NULL, - &ndevMountsPath) < 0) - goto cleanup; + if (qemuDomainGetPreservedMounts(cfg, vm, &devMountsPath, NULL, NULL) < 0) + return -1; for (i = 0; i < npaths; i++) { const char *file = paths[i]; @@ -1387,10 +1383,7 @@ qemuNamespaceUnlinkPaths(virDomainObjPtr vm, unlinkPaths) < 0) return -1; - ret = 0; - cleanup: - virStringListFreeCount(devMountsPath, ndevMountsPath); - return ret; + return 0; }