From nobody Mon Feb 9 01:51:22 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1652281506; cv=none; d=zohomail.com; s=zohoarc; b=kAzFBzWBek/bcaC9zs9uANj0JZVXcAsdsy8IabGpIPpe1jFPVGjdl4WQ8uc2fTO2RMWwBngbG8ghMljkLvvv2fOT6x/GwvRMVFBlhBpcCOllHtp1KTLGrruT6mi/ZLYTmnTuvmvEdeCeEVbDmIYggaYNaFpQgqpEdi5XZ8usBiQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1652281506; h=Content-Type:Content-Transfer-Encoding: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=RACBMckGFFzf2gvAvflZy/g0+NkEDB4pYSlt9Ckn6JM=; b=CIk2+1V3gaYZePBwovqCEyuekzSElL0QbMWeh1VblLfWdraVrMk/Dd145vtxBMmbJFxGNkKp/bjvt0FD2+vLvV6dVRbmJ1WbQ0mwt32DLHaRG+4R0DgYli64BkBlWj3R4wlufkPCIpR/LJm7hdouEmlaNsmJQMiE9OQ8DBIXsPg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1652281506552455.9418540282418; Wed, 11 May 2022 08:05:06 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-25-RkvNayAMPBWFDfiYUQeAfA-1; Wed, 11 May 2022 11:04:08 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9C4C23831C5D; Wed, 11 May 2022 15:04:03 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 88952C27E9E; Wed, 11 May 2022 15:04:03 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 520161947B84; Wed, 11 May 2022 15:04:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3C061194707B for ; Wed, 11 May 2022 15:03:28 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1EDA11121315; Wed, 11 May 2022 15:03:28 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.180]) by smtp.corp.redhat.com (Postfix) with ESMTP id BB0EB1121314 for ; Wed, 11 May 2022 15:03:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652281505; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=RACBMckGFFzf2gvAvflZy/g0+NkEDB4pYSlt9Ckn6JM=; b=EOItiSKYXpsovwsQJL6frKGc6MnLusBZV0kIWfLWGEkXjMeFbOipDgUsqqr9yi8fzGCY3z 6R/8UCzdhalll4Ir/WUCHkHX1JKqjRqzJyfAMY6wY2yOoWVsTzBoWLdoeYwKN5grLRVqaW 5ioJy7C2Paa2jj7LZrIMdNppo6zw9II= X-MC-Unique: RkvNayAMPBWFDfiYUQeAfA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/4] qemu_domain: Drop needless free from qemuDomainObjPrivateXMLParse() Date: Wed, 11 May 2022 17:03:18 +0200 Message-Id: <62cb4a8171c865412d1230bb96066da6b386385a.1652281291.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1652281507622100001 Content-Type: text/plain; charset="utf-8"; x-default="true" The qemuDomainObjPrivateXMLParse() is responsible for parsing given XML into qemuDomainObjPrivate struct. As it does so, memory might be allocated for some members. If an error occurs during parsing the control jumps onto 'error' label where only some of previously allocated memory is freed. The reason there's no memory leak is simple: the only caller (virDomainObjParseXML()) unrefs freshly created virDomainObj which in turn causes qemuDomainObjPrivateFree() to be called. Therefore, these partial, selective frees are needless and should be just dropped. Signed-off-by: Michal Privoznik --- src/qemu/qemu_domain.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 9602a42196..4de4840c8e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3118,9 +3118,6 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, return 0; =20 error: - g_clear_pointer(&priv->namespaces, virBitmapFree); - g_clear_pointer(&priv->monConfig, virObjectUnref); - g_clear_pointer(&priv->qemuDevices, g_strfreev); return -1; } =20 --=20 2.35.1