- virStringSplit may return NULL
- VIR_ALLOC_N initialize the array already
Cc: John Ferlan <jferlan(a)redhat.com>
Signed-off-by: Marek Marczykowski-Górecki <marmarek(a)invisiblethingslab.com>
---
src/xenconfig/xen_common.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/xenconfig/xen_common.c b/src/xenconfig/xen_common.c
index ff0df5fb7..ca3b4dee6 100644
--- a/src/xenconfig/xen_common.c
+++ b/src/xenconfig/xen_common.c
@@ -968,6 +968,9 @@ xenParseVif(virConfPtr conf, virDomainDefPtr def, const char
*vif_typename)
char **ip_list = virStringSplit(ip, " ", 0);
size_t i;
+ if (!ip_list)
+ goto cleanup;
+
for (i = 0; ip_list[i]; i++) {
if (virDomainNetAppendIPAddress(net, ip_list[i], 0, 0) < 0) {
virStringListFree(ip_list);
@@ -1191,8 +1194,6 @@ xenMakeIPList(virNetDevIPInfoPtr guestIP)
if (!address_array[i])
goto cleanup;
}
- address_array[guestIP->nips] = NULL;
-
ret = virStringListJoin((const char**)address_array, " ");
cleanup:
--
2.13.6