From nobody Thu May 16 19:12:14 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1585923785; cv=none; d=zohomail.com; s=zohoarc; b=FyhkP7saOIVWjyWUPtV0wu5MymWRcXbJyr8yorfWCfCBUqzym/oikygynjSrJseOoGlh7xfg8FZmYUzkk6fNAG0U1UxebkFvYPlzX+CGztELRoDw5h5W7ZFZpYjVxnNeBe8bK+t9jQVeSV46By12GSuLdrJVnp/ZimuZGNa41mI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585923785; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To; bh=Euu+juODTaGWJYIMQ6qe+Zje1HPsYmI2RKih2R/jzvw=; b=ULgTYHzYUKkdp6QI9+VUJN9ev2mQMGR7iltx/wlnaq/OhECqJvQxXvzkPmzhu8HrmxsyjdYL2X77XmRFFv0v2rnoNfdDMj4/2cLoCI2BYi/3oGn5ikIGCVkC5NcjHrK5KxLm8VP8JtDm2J19BFdqRpNf959YFdDC6VWh2Xp0ydw= 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 Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1585923785621105.89242423805172; Fri, 3 Apr 2020 07:23:05 -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-198-xho-6dQFP4Kq1cTiiMF-ng-1; Fri, 03 Apr 2020 10:23:01 -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 ED2048017CE; Fri, 3 Apr 2020 14:22:55 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BF9B95C1BE; Fri, 3 Apr 2020 14:22:55 +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 736A74E45D; Fri, 3 Apr 2020 14:22:55 +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 033EMrEh025521 for ; Fri, 3 Apr 2020 10:22:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9BA5413CC85; Fri, 3 Apr 2020 14:22:53 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 975EC13CC8A for ; Fri, 3 Apr 2020 14:22:51 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.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 3F6F980029B for ; Fri, 3 Apr 2020 14:22:51 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-44-_LLlJ15pPGW8j2jV8khKWQ-1; Fri, 03 Apr 2020 10:22:49 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 033E7eqP071910 for ; Fri, 3 Apr 2020 10:22:48 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0b-001b2d01.pphosted.com with ESMTP id 305s83djpq-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 03 Apr 2020 10:22:48 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 3 Apr 2020 15:22:44 +0100 Received: from b06avi18626390.portsmouth.uk.ibm.com (9.149.26.192) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 3 Apr 2020 15:22:41 +0100 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 033ELdWk48955768 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 3 Apr 2020 14:21:39 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E1708A405B; Fri, 3 Apr 2020 14:22:42 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E9DFCA4054; Fri, 3 Apr 2020 14:22:41 +0000 (GMT) Received: from oc2388111647.ibm.com (unknown [9.85.69.18]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 3 Apr 2020 14:22:41 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585923784; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Euu+juODTaGWJYIMQ6qe+Zje1HPsYmI2RKih2R/jzvw=; b=RYkes9Dc7E7JFVE4cEwONpQ/LI0QmLIBXFL5nCvbcYXKHWbfOj+YKsbOgb2f9/E5V8zT/a TfwqZubZ0IxAeqKEe8Vu8VtGFpqs1n64uCuUBscfWgVToQuYU1URXAUmMZ+d+QVr2QC3yu 2dDOhHUCzJsxXTNqNFqs7ou09GmbEwo= X-MC-Unique: xho-6dQFP4Kq1cTiiMF-ng-1 X-MC-Unique: _LLlJ15pPGW8j2jV8khKWQ-1 From: Seeteena Thoufeek To: libvir-list@redhat.com Subject: [PATCH] cpu.c: Use g_autoptr and g_autofree in virCPUDataParse Date: Fri, 3 Apr 2020 19:52:36 +0530 X-TM-AS-GCONF: 00 x-cbid: 20040314-0028-0000-0000-000003F15790 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20040314-0029-0000-0000-000024B6E586 Message-Id: <1585923756-7256-1-git-send-email-s1seetee@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-03_11:2020-04-03, 2020-04-03 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 mlxlogscore=655 impostorscore=0 phishscore=0 malwarescore=0 bulkscore=0 clxscore=1015 priorityscore=1501 mlxscore=0 suspectscore=3 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004030125 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 033EMrEh025521 X-loop: libvir-list@redhat.com Cc: s1seetee@linux.vnet.ibm.com 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: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Seeteena Thoufeek --- src/cpu/cpu.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 631c755..e556ffe 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -772,40 +772,36 @@ virCPUDataPtr virCPUDataParse(const char *xmlStr) { struct cpuArchDriver *driver; - xmlDocPtr xml =3D NULL; - xmlXPathContextPtr ctxt =3D NULL; + g_autoptr(xmlDoc) xml =3D NULL; + g_autoptr(xmlXPathContext) ctxt =3D NULL; virCPUDataPtr data =3D NULL; - char *arch =3D NULL; + g_autofree char *arch =3D NULL; =20 VIR_DEBUG("xmlStr=3D%s", xmlStr); =20 if (!(xml =3D virXMLParseStringCtxt(xmlStr, _("CPU data"), &ctxt))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("cannot parse CPU data")); - goto cleanup; + return data; } =20 if (!(arch =3D virXPathString("string(/cpudata/@arch)", ctxt))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing CPU data architecture")); - goto cleanup; + return data; } =20 if (!(driver =3D cpuGetSubDriverByName(arch))) - goto cleanup; + return data; =20 if (!driver->dataParse) { virReportError(VIR_ERR_NO_SUPPORT, _("cannot parse %s CPU data"), arch); - goto cleanup; + return data; } =20 data =3D driver->dataParse(ctxt); =20 - cleanup: - xmlXPathFreeContext(ctxt); - xmlFreeDoc(xml); - VIR_FREE(arch); return data; } =20 --=20 1.8.3.1