Remove the need for a couple of sa_asserts.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
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;
--
2.1.0