From nobody Thu May 16 11:57:47 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=1586179474; cv=none; d=zohomail.com; s=zohoarc; b=ebNoWd/ty1d2H2y6x8L5hzkBS6T6LqGBuNWWw0iCc0Ob+1OEbfYCYqwRyrtwy1BPyaDfyglUdlK1mZP/2s7rpgA9lxdLasqs55Zw/OstPodOLz5/iENBN6D+0WmC1vI42o4okZSb6yW/YDNdt/saFXNmq3pezhGyld875SUvZ+A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586179474; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=2/s3GN8SUCXBGpu0sDKOxhLtXrWzq876SlNv8E9DnQ8=; b=ahq4FwhqtFVS1QJe8lnjUIJVB1xiQCaj4ORMjvJbWue4Cxo3v4PJI2cjZovIs4/KoPcvuAdCCmzZPOjrZlD84kWyndg0R/z3L8y0bwyYFb680xs1+W9yvgNgJcv2GNrPgWv8FKDPFW46++Yw+a80bHbE2NUwKP6c5kmRq2uvvSg= 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 15861794747601000.5296103786586; Mon, 6 Apr 2020 06:24:34 -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-324-FsbvklDFOcWSE2wJJq7FIQ-1; Mon, 06 Apr 2020 09:24:30 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7F726800D5C; Mon, 6 Apr 2020 13:24:23 +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 4860C60BE0; Mon, 6 Apr 2020 13:24:23 +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 E9AD51803C38; Mon, 6 Apr 2020 13:24:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 036DOLH9015718 for ; Mon, 6 Apr 2020 09:24:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4A00A2166B2D; Mon, 6 Apr 2020 13:24:21 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 45B992166B29 for ; Mon, 6 Apr 2020 13:24:18 +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 D3E868007D4 for ; Mon, 6 Apr 2020 13:24:18 +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-445-pNWclG4SN8KoP4P5U-V8Xw-1; Mon, 06 Apr 2020 09:24:16 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 036DHdSk006529 for ; Mon, 6 Apr 2020 09:24:16 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0b-001b2d01.pphosted.com with ESMTP id 3082f1d2xx-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 06 Apr 2020 09:24:16 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 6 Apr 2020 14:23:53 +0100 Received: from b06avi18626390.portsmouth.uk.ibm.com (9.149.26.192) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 6 Apr 2020 14:23:51 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06avi18626390.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 036DN8u045875546 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 6 Apr 2020 13:23:08 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 47C684C046; Mon, 6 Apr 2020 13:24:12 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 92EE74C040; Mon, 6 Apr 2020 13:24:11 +0000 (GMT) Received: from oc2388111647.ibm.com (unknown [9.199.40.180]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 6 Apr 2020 13:24:11 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586179473; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=2/s3GN8SUCXBGpu0sDKOxhLtXrWzq876SlNv8E9DnQ8=; b=IJmowh8P/1ywuPdcRnT3eQpLiHxYcm/A8qPgOD3YjzL1bHV2z2Gof9VT8MLJddhGRQW+h/ y+2O10aTc4ePM6SuRx1MWNAQyZ2O1n1WIMaRnyLf+AExbdcab8hBLhv+EYd8jA+10Tigjt h/PRgBJT8qk/0BZm1yV3q/vn/S6V+pc= X-MC-Unique: FsbvklDFOcWSE2wJJq7FIQ-1 X-MC-Unique: pNWclG4SN8KoP4P5U-V8Xw-1 From: Seeteena Thoufeek To: libvir-list@redhat.com Subject: [PATCHv2 1/1] cpu: Use g_autoptr and g_autofree in cpu.c Date: Mon, 6 Apr 2020 18:54:06 +0530 In-Reply-To: <1586179446-32013-1-git-send-email-s1seetee@linux.vnet.ibm.com> References: <1586179446-32013-1-git-send-email-s1seetee@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 20040613-4275-0000-0000-000003BAACC3 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20040613-4276-0000-0000-000038D00A87 Message-Id: <1586179446-32013-2-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-06_07:2020-04-06, 2020-04-06 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=3 mlxscore=0 spamscore=0 clxscore=1015 malwarescore=0 adultscore=0 phishscore=0 mlxlogscore=620 bulkscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004060109 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 036DOLH9015718 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.12 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 Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 631c755..d502c02 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -772,40 +772,35 @@ 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 NULL; } =20 if (!(arch =3D virXPathString("string(/cpudata/@arch)", ctxt))) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing CPU data architecture")); - goto cleanup; + return NULL; } =20 if (!(driver =3D cpuGetSubDriverByName(arch))) - goto cleanup; + return NULL; =20 if (!driver->dataParse) { virReportError(VIR_ERR_NO_SUPPORT, _("cannot parse %s CPU data"), arch); - goto cleanup; + return NULL; } =20 data =3D driver->dataParse(ctxt); - - cleanup: - xmlXPathFreeContext(ctxt); - xmlFreeDoc(xml); - VIR_FREE(arch); return data; } =20 --=20 1.8.3.1