From nobody Fri May 16 03:29:39 2025 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.zoho.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 1498759465525830.5135125910165; Thu, 29 Jun 2017 11:04:25 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 098171176D6; Thu, 29 Jun 2017 18:04:19 +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 D4B05179DE; Thu, 29 Jun 2017 18:04:18 +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 4E3AC1841C41; Thu, 29 Jun 2017 18:04:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5TI4E59006680 for ; Thu, 29 Jun 2017 14:04:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8C94C179DB; Thu, 29 Jun 2017 18:04:14 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.82]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1643117C75 for ; Thu, 29 Jun 2017 18:04:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 098171176D6 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 098171176D6 From: Andrea Bolognani To: libvir-list@redhat.com Date: Thu, 29 Jun 2017 20:03:56 +0200 Message-Id: <1498759443-10136-4-git-send-email-abologna@redhat.com> In-Reply-To: <1498759443-10136-1-git-send-email-abologna@redhat.com> References: <1498759443-10136-1-git-send-email-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 03/10] conf: Clean up virDomainHostdevDefNew() 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: , MIME-Version: 1.0 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 29 Jun 2017 18:04:19 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Follow the same style as other similar functions. Signed-off-by: Andrea Bolognani --- src/conf/domain_conf.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 15dd285..ccd3c27 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2380,25 +2380,26 @@ void virDomainVideoDefFree(virDomainVideoDefPtr def) virDomainHostdevDefPtr virDomainHostdevDefNew(virDomainXMLOptionPtr xmlopt) { - virDomainHostdevDefPtr def =3D NULL; + virDomainHostdevDefPtr def; =20 - if (VIR_ALLOC(def) < 0 || - VIR_ALLOC(def->info) < 0) { - VIR_FREE(def); + if (VIR_ALLOC(def) < 0) return NULL; - } + + if (VIR_ALLOC(def->info) < 0) + goto error; =20 if (xmlopt && xmlopt->privateData.hostdevNew && !(def->privateData =3D xmlopt->privateData.hostdevNew())) goto error; =20 + cleanup: return def; =20 error: VIR_FREE(def->info); VIR_FREE(def); - return NULL; + goto cleanup; } =20 =20 --=20 2.7.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list