From nobody Tue Nov 26 15:18:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571852828; cv=none; d=zoho.com; s=zohoarc; b=Gd0nZWQDMLSfBlyOuXHsmd7k/kmTmVyz8fgcMjMPB/U9NpWg/bv8iJ7t+aBYF5D2E7KHiFAwbJHmrMrVEojgXi3O17STwQwYNpfuymFBVlBLzeeMJJJhNQ9NdoGU/PJW6NBVwYHa3tIScrVwP3uYiYnQrs0QK4DoDqyo7upWpZg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571852828; 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=wxvn2wkVIPVGhv3uzsLmq0a0GHT7be6JV0lvL2A//UU=; b=He8dyEEQVpwSZwyQrTIdyI/yYNXv4GAWInroIPYXFOoCpWGYA2IEBJF2vCwJ998VYp3kmWYj7g/l2hjdlkeUzwGjTDoV0Dacjb767AA357KNhVKeS2XBfxg/pL0sGOylUrtK6cwDILkGOhurU/EnMQb/YO9gVH1VWYZlVSPC6DE= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1571852828481496.0223771548689; Wed, 23 Oct 2019 10:47:08 -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-359-OFsVYpGmOJaY5cEC_nVFmQ-1; Wed, 23 Oct 2019 13:47:05 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id A8503800D49; Wed, 23 Oct 2019 17:47:00 +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 6BF335D6D0; Wed, 23 Oct 2019 17:47:00 +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 2ABAE4E58C; Wed, 23 Oct 2019 17:46:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9NHksbj008833 for ; Wed, 23 Oct 2019 13:46:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 80E2D60629; Wed, 23 Oct 2019 17:46:54 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-117-228.phx2.redhat.com [10.3.117.228]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 396606061E; Wed, 23 Oct 2019 17:46:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571852827; 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=wxvn2wkVIPVGhv3uzsLmq0a0GHT7be6JV0lvL2A//UU=; b=JP65kvuISNi+xdFoWQwE33/GLA0BjDmVQYMduzRxKkTDdqw31l/vpS+5ngxiqTN6tpyJQh IbjU/kGBTvCyItQHJyF5KR47zlsI6OZZAZ23p7u4kLULmFe3cYUCM/8MCbrOgQwrIFjdwQ p18pHs9gtmkN29ZopKBn2avwpAVvU/s= From: Jonathon Jongsma To: libvir-list@redhat.com Date: Wed, 23 Oct 2019 12:46:47 -0500 Message-Id: <20191023174649.28887-4-jjongsma@redhat.com> In-Reply-To: <20191023174649.28887-1-jjongsma@redhat.com> References: <20191023174649.28887-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: jtomko@redhat.com, crobinso@redhat.com Subject: [libvirt] [PATCH v2 3/5] conf: use glib allocation when parsing video props 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.15 X-MC-Unique: OFsVYpGmOJaY5cEC_nVFmQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" In preparation for some other improvements, switch to using glib allocation and g_autofree when parsing the 'acceleration' and 'resolution' properties of the video device. Signed-off-by: Jonathon Jongsma --- src/conf/domain_conf.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ad1d3ffea6..269a6ec2c3 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15289,7 +15289,7 @@ static virDomainVideoAccelDefPtr virDomainVideoAccelDefParseXML(xmlNodePtr node) { xmlNodePtr cur; - virDomainVideoAccelDefPtr def; + g_autofree virDomainVideoAccelDefPtr def =3D NULL; int val; g_autofree char *accel2d =3D NULL; g_autofree char *accel3d =3D NULL; @@ -15311,8 +15311,7 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node) if (!accel3d && !accel2d && !rendernode) return NULL; =20 - if (VIR_ALLOC(def) < 0) - goto cleanup; + def =3D g_new0(virDomainVideoAccelDef, 1); =20 if (accel3d) { if ((val =3D virTristateBoolTypeFromString(accel3d)) <=3D 0) { @@ -15336,14 +15335,14 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node) def->rendernode =3D virFileSanitizePath(rendernode); =20 cleanup: - return def; + return g_steal_pointer(&def); } =20 static virDomainVideoResolutionDefPtr virDomainVideoResolutionDefParseXML(xmlNodePtr node) { xmlNodePtr cur; - virDomainVideoResolutionDefPtr def; + g_autofree virDomainVideoResolutionDefPtr def =3D NULL; g_autofree char *x =3D NULL; g_autofree char *y =3D NULL; =20 @@ -15362,8 +15361,7 @@ virDomainVideoResolutionDefParseXML(xmlNodePtr node) if (!x || !y) return NULL; =20 - if (VIR_ALLOC(def) < 0) - goto cleanup; + def =3D g_new0(virDomainVideoResolutionDef, 1); =20 if (virStrToLong_uip(x, NULL, 10, &def->x) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -15378,7 +15376,7 @@ virDomainVideoResolutionDefParseXML(xmlNodePtr node) } =20 cleanup: - return def; + return g_steal_pointer(&def); } =20 static virDomainVideoDriverDefPtr --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list