diff --git a/src/parallels/parallels_storage.c b/src/parallels/parallels_storage.c index 4dbaed18ca..53bcfcb32b 100644 --- a/src/parallels/parallels_storage.c +++ b/src/parallels/parallels_storage.c @@ -340,7 +340,7 @@ static int parallelsFindVmVolumes(virStoragePoolObjPtr pool, virReportSystemError(errno, _("cannot open path '%s'"), pdom->home); - goto cleanup; + return ret; } while ((direrr = virDirRead(dir, &ent, pdom->home)) > 0) { diff --git a/src/util/virscsi.c b/src/util/virscsi.c index 9a0205ff88..9f5cf0daa1 100644 --- a/src/util/virscsi.c +++ b/src/util/virscsi.c @@ -143,7 +143,8 @@ virSCSIDeviceGetSgName(const char *sysfs_prefix, } cleanup: - closedir(dir); + if (dir) + closedir(dir); VIR_FREE(path); return sg; } @@ -188,7 +189,8 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix, } cleanup: - closedir(dir); + if (dir) + closedir(dir); VIR_FREE(path); return name; }