提交 48b78519 编写于 作者: P Peter Krempa

storage_backend_fs: Allocate entry for host before accessing it

Commit 122fa379 introduces option to
store more than one host entry in a storage pool source definition. That
commit causes a regression, where a check is added that only one host
entry should be present (that actualy is not present as the source
structure was just allocated and zeroed) instead of allocating memory
for the host entry.
上级 ab9c72ae
......@@ -205,11 +205,11 @@ virStorageBackendFileSystemNetFindPoolSourcesFunc(virStoragePoolObjPtr pool ATTR
if (!(src = virStoragePoolSourceListNewSource(&state->list)))
goto cleanup;
if (src->nhost != 1) {
virStorageReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Expected exactly 1 host for the storage pool"));
if (VIR_ALLOC_N(src->hosts, 1) < 0) {
virReportOOMError();
goto cleanup;
}
src->nhost = 1;
if (!(src->hosts[0].name = strdup(state->host)) ||
!(src->dir = strdup(path))) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册