From nobody Sun Feb 8 16:24:15 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1592468752; cv=none; d=zohomail.com; s=zohoarc; b=lLFar4uphkXUnwzCj9tNIugzJGKDjcSFjRwQO0BgGnagasHt4klSJ6JHmXMjI9u9BtSueUwd3nVM4+b+cUH9RaRyLvxLGNVFqoZRClMXHhPyAPv2uXDqKW1YwgVTJqXO+adjFg1JazF8ckevD0Ekuuzn/XocaKrVIMyEES/gyfs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1592468752; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=lWy9fWkIjKDXXZ4n/IHw5XsHvSexvZux6eQUQ0tXHRI=; b=B295rq7IROqWo7GhWyHhYDB0F27A2ZOTmCac7rvP5Z+j3TT/2IPn8944FbUrF9yEf+pEXO2hvuoFTYrXUOIU7aAjGQBsoqONibxwVzi+O3Z3Gdh1LOiCjIhl36OgsT8k+7hsQEkv911GdHjQzDbVgiogy1sGoVyyPONqFaJeJ+o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 159246875297537.800811936283026; Thu, 18 Jun 2020 01:25:52 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-484-4ZDy5MFaOnm0zTqyj6IH6Q-1; Thu, 18 Jun 2020 04:25:48 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2F7EC8035E1; Thu, 18 Jun 2020 08:25:42 +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 0D1EF5C1D6; Thu, 18 Jun 2020 08:25:42 +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 A0F1C1809561; Thu, 18 Jun 2020 08:25:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 05I8PdSt022092 for ; Thu, 18 Jun 2020 04:25:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 78452F11FF; Thu, 18 Jun 2020 08:25:39 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 72CE6F18BE for ; Thu, 18 Jun 2020 08:25:37 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0CE9F811E7A for ; Thu, 18 Jun 2020 08:25:37 +0000 (UTC) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-201-TVrj1tgUNPGRw4B1qR39Tw-1; Thu, 18 Jun 2020 04:25:34 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 05I82BHU079515 for ; Thu, 18 Jun 2020 04:25:34 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 31qt6h0v9g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Jun 2020 04:25:33 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 05I8K0Id029035 for ; Thu, 18 Jun 2020 08:25:32 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma04ams.nl.ibm.com with ESMTP id 31qur60nwq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 18 Jun 2020 08:25:32 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 05I8PSH412714346 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 Jun 2020 08:25:28 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A375EA4040; Thu, 18 Jun 2020 08:25:28 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 81778A4057; Thu, 18 Jun 2020 08:25:28 +0000 (GMT) Received: from m46lp68.lnxne.boe (unknown [9.152.108.100]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 18 Jun 2020 08:25:28 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592468751; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=lWy9fWkIjKDXXZ4n/IHw5XsHvSexvZux6eQUQ0tXHRI=; b=GHj2elwvJGnDdw5qfqJXMGMKNJXH13Jz8zbH8N9Z9x6oM4IxsbtMWTbxH0fDasqLs0/zpr M4drY5lrcVZ21SpapBJ0gFKeaMm8SvB64RnYbNFzVXSK4HNdxEC3IRn+JCcj2eQdd3fUoB Ho1B2lPIN33zzMQwIHliHCFhoMeI9ag= X-MC-Unique: 4ZDy5MFaOnm0zTqyj6IH6Q-1 X-MC-Unique: TVrj1tgUNPGRw4B1qR39Tw-1 From: Shalini Chellathurai Saroja To: libvir-list@redhat.com Subject: [PATCH libvirt v2 1/5] conf: use g_autofree to ensure automatic cleanup Date: Thu, 18 Jun 2020 10:25:14 +0200 Message-Id: <20200618082518.98780-2-shalini@linux.ibm.com> In-Reply-To: <20200618082518.98780-1-shalini@linux.ibm.com> References: <20200618082518.98780-1-shalini@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-18_04:2020-06-17, 2020-06-18 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 cotscore=-2147483648 mlxlogscore=937 spamscore=0 adultscore=0 impostorscore=0 phishscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 suspectscore=3 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006180057 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Shalini Chellathurai Saroja 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Bjoern Walk Signed-off-by: Shalini Chellathurai Saroja Reviewed-by: Boris Fiuczynski Reviewed-by: Andrea Bolognani --- src/conf/device_conf.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 4dbd5c1a..1d06981a 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -53,9 +53,8 @@ virZPCIDeviceAddressParseXML(xmlNodePtr node, virPCIDeviceAddressPtr addr) { virZPCIDeviceAddress def =3D { 0 }; - char *uid; - char *fid; - int ret =3D -1; + g_autofree char *uid =3D NULL; + g_autofree char *fid =3D NULL; =20 uid =3D virXMLPropString(node, "uid"); fid =3D virXMLPropString(node, "fid"); @@ -64,27 +63,23 @@ virZPCIDeviceAddressParseXML(xmlNodePtr node, virStrToLong_uip(uid, NULL, 0, &def.uid) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Cannot parse
'uid' attribute")); - goto cleanup; + return -1; } =20 if (fid && virStrToLong_uip(fid, NULL, 0, &def.fid) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Cannot parse
'fid' attribute")); - goto cleanup; + return -1; } =20 if (!virZPCIDeviceAddressIsEmpty(&def) && !virZPCIDeviceAddressIsValid(&def)) - goto cleanup; + return -1; =20 addr->zpci =3D def; - ret =3D 0; =20 - cleanup: - VIR_FREE(uid); - VIR_FREE(fid); - return ret; + return 0; } =20 void --=20 2.25.4