From nobody Thu Apr 25 14:05:38 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; dmarc=pass(p=none dis=none) header.from=redhat.com 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 15808623960921009.0775504515137; Tue, 4 Feb 2020 16:26:36 -0800 (PST) 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-400-yO5Vb_lWN46GT00wa0x-lw-1; Tue, 04 Feb 2020 19:26:32 -0500 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 AAFE81088382; Wed, 5 Feb 2020 00:26:26 +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 22C4F5C1B2; Wed, 5 Feb 2020 00:26:25 +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 12D5E8173F; Wed, 5 Feb 2020 00:26:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0150QJhj017187 for ; Tue, 4 Feb 2020 19:26:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0A55584D90; Wed, 5 Feb 2020 00:26:19 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-20.brq.redhat.com [10.40.200.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id DCB80811F8; Wed, 5 Feb 2020 00:26:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580862394; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=d4uTBDdhdxbaRqjRBjFQa4cIvPPZxcWmWEmiDWTR9vI=; b=L9ozGbB792O0thUFNuGZFP3j1XPnlbYWRURND/EeUZ0AneC1kRQNc3Ghgd2L+xysESDr0T k+/pJesCwZJjsVMFMJB1dVuyYlZCYp3MQ12O8/ZpPvX1PookV4VB9xzJ+YZiOpyOmHC5m+ iQI9boZ/6nalXmr2OepXg143p01MHSg= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH] conf: use correct free function for virDomainDeviceDef Date: Wed, 5 Feb 2020 01:26:11 +0100 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: xuyandong2@huawei.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-MC-Unique: yO5Vb_lWN46GT00wa0x-lw-1 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" Simple g_autofree is not enough if we put allocated data into the device structure. Define the AUTOPTR_CLEANUP function and use it here. Signed-off-by: J=C3=A1n Tomko Reported-by: Xu Yandong Reviewed-by: Peter Krempa --- src/conf/domain_conf.c | 2 +- src/conf/domain_conf.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c95bd34fb5..c3214dc4f3 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -16516,7 +16516,7 @@ virDomainDeviceDefParse(const char *xmlStr, g_autoptr(xmlDoc) xml =3D NULL; xmlNodePtr node; g_autoptr(xmlXPathContext) ctxt =3D NULL; - g_autofree virDomainDeviceDefPtr dev =3D NULL; + g_autoptr(virDomainDeviceDef) dev =3D NULL; =20 if (!(xml =3D virXMLParseStringCtxt(xmlStr, _("(device_definition)"), = &ctxt))) return NULL; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e144f3aad3..c3acb29e6f 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2916,6 +2916,7 @@ void virDomainRedirdevDefFree(virDomainRedirdevDefPtr= def); void virDomainRedirFilterDefFree(virDomainRedirFilterDefPtr def); void virDomainShmemDefFree(virDomainShmemDefPtr def); void virDomainDeviceDefFree(virDomainDeviceDefPtr def); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainDeviceDef, virDomainDeviceDefFree); virDomainDeviceDefPtr virDomainDeviceDefCopy(virDomainDeviceDefPtr src, const virDomainDef *def, virDomainXMLOptionPtr xmlopt, --=20 2.21.0