Re: [PATCH 5/5] conf: Remove need for a couple of sa_asserts

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

 



On 09/04/2015 10:31 AM, John Ferlan wrote:
Remove the need for a couple of sa_asserts.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
  src/conf/domain_conf.c | 9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f95190f..6df1618 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -24067,10 +24067,11 @@ virDomainObjListCollect(virDomainObjListPtr domlist,
                          unsigned int flags)
  {
      struct virDomainListData data = { NULL, 0 };
+    ssize_t hash_size;
virObjectLock(domlist);
-    sa_assert(domlist->objs);
-    if (VIR_ALLOC_N(data.vms, virHashSize(domlist->objs)) < 0) {
+    if ((hash_size = virHashSize(domlist->objs)) < 0 ||
+        (VIR_ALLOC_N(data.vms, hash_size) < 0)) {
          virObjectUnlock(domlist);
          return -1;
      }
@@ -24132,8 +24133,8 @@ virDomainObjListConvert(virDomainObjListPtr domlist,
      }
      virObjectUnlock(domlist);
- sa_assert(*vms);
-    virDomainObjListFilter(vms, nvms, conn, filter, flags);
+    if (*vms)
+        virDomainObjListFilter(vms, nvms, conn, filter, flags);
return 0;

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]