Re: [PATCH 3/3] storage_backend_fs: Allocate entry for host before accessing it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2012年07月09日 21:21, Peter Krempa wrote:
Commit 122fa379de44a2fd0a6d5fbcb634535d647ada17 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.
---
  src/storage/storage_backend_fs.c |    6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 5e3da14..5eb486e 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -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))) {


ACK

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]