mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 10:35:20 +00:00
Do not call closedir with NULL argument
Only three other callers possibly call closedir on a NULL argument. Even though these probably won't be used on FreeBSD where this crashes, let's be nice and only call closedir on an actual directory stream.
This commit is contained in:
parent
9a2e523eba
commit
10af0a1973
@ -340,7 +340,7 @@ static int parallelsFindVmVolumes(virStoragePoolObjPtr pool,
|
|||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("cannot open path '%s'"),
|
_("cannot open path '%s'"),
|
||||||
pdom->home);
|
pdom->home);
|
||||||
goto cleanup;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((direrr = virDirRead(dir, &ent, pdom->home)) > 0) {
|
while ((direrr = virDirRead(dir, &ent, pdom->home)) > 0) {
|
||||||
|
@ -143,7 +143,8 @@ virSCSIDeviceGetSgName(const char *sysfs_prefix,
|
|||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
closedir(dir);
|
if (dir)
|
||||||
|
closedir(dir);
|
||||||
VIR_FREE(path);
|
VIR_FREE(path);
|
||||||
return sg;
|
return sg;
|
||||||
}
|
}
|
||||||
@ -188,7 +189,8 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix,
|
|||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
closedir(dir);
|
if (dir)
|
||||||
|
closedir(dir);
|
||||||
VIR_FREE(path);
|
VIR_FREE(path);
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user