From nobody Tue Apr 30 03:54:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1513192572489946.416508916306; Wed, 13 Dec 2017 11:16:12 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9765C4A700; Wed, 13 Dec 2017 19:16:11 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6FFA27BA39; Wed, 13 Dec 2017 19:16:11 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D8F0F180474A; Wed, 13 Dec 2017 19:16:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id vBDJG9IG023949 for ; Wed, 13 Dec 2017 14:16:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id E12307EE75; Wed, 13 Dec 2017 19:16:09 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C4FCB600D3; Wed, 13 Dec 2017 19:16:06 +0000 (UTC) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EBA002BB8; Wed, 13 Dec 2017 19:16:05 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id BD67E20CE2; Wed, 13 Dec 2017 14:16:04 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute7.internal (MEProxy); Wed, 13 Dec 2017 14:16:04 -0500 Received: from localhost.localdomain (ip5b40bfaa.dynamic.kabel-deutschland.de [91.64.191.170]) by mail.messagingengine.com (Postfix) with ESMTPA id 00F877E4AA; Wed, 13 Dec 2017 14:16:01 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=xrLIZYJXgee0FtxbtYDQ3hZqXFz93 ey99I784iqw2SA=; b=TVmEw0UQwHDp4hCBcGPCjs/Qa9/r/RX5LRrX/fnh/Qt+f 0HMqWb8CRa/as9nTtGJ8NWGC3lRXVI8CGc120vFFLl1y97oPjOoOfGjfUGsOYZqE JgMx/Nku0ykzzlJevOpMqqY9OyiZkWj9JITHUU24MKYLYv6hNN1ao7KT9zlqLnSP mhq8ETbBJafRcMfIOMJPJzrFAMz/JIG+A0tzr93sINCqkn9TSpbGIiHCTQG7v8hw 6CHYpMATrPB/tU9P4VFJ87gdZwEuMv/iqA1CqY+hjggxk7647uJWKOT3Kqzco9ak yiwpDrrL2v63vmlNdhsg2v0sFVvvfeXFC5gJgvxlw== X-ME-Sender: From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= To: libvir-list@redhat.com Date: Wed, 13 Dec 2017 20:15:49 +0100 Message-Id: <20171213191549.8680-1-marmarek@invisiblethingslab.com> MIME-Version: 1.0 Organization: Invisible Things Lab X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 13 Dec 2017 19:16:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 13 Dec 2017 19:16:06 +0000 (UTC) for IP:'66.111.4.27' DOMAIN:'out3-smtp.messagingengine.com' HELO:'out3-smtp.messagingengine.com' FROM:'marmarek@invisiblethingslab.com' RCPT:'' X-RedHat-Spam-Score: -0.7 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW) 66.111.4.27 out3-smtp.messagingengine.com 66.111.4.27 out3-smtp.messagingengine.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] xenconfig: fix issues found by coverity in multiple IP support X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 13 Dec 2017 19:16:12 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 - virStringSplit may return NULL - VIR_ALLOC_N initialize the array already Cc: John Ferlan Signed-off-by: Marek Marczykowski-G=C3=B3recki --- 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 =3D virStringSplit(ip, " ", 0); size_t i; =20 + if (!ip_list) + goto cleanup; + for (i =3D 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] =3D NULL; - ret =3D virStringListJoin((const char**)address_array, " "); =20 cleanup: --=20 2.13.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list