提交 10af0a19 编写于 作者: J Ján Tomko

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.
上级 9a2e523e
......@@ -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) {
......
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册