From nobody Mon Nov 25 14:57:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1602770581; cv=none; d=zohomail.com; s=zohoarc; b=gZjpg54Mq+I/af1MXudQ0C7xLcgYlzLDCxv9egvdqWQHiEs5QtMixg5NHaTCGyvRusI3Rt/3A6azEIyKbM8JxCy6NTdklSaJwXarvuF1Hokgs+vREf+PfdKZkISWMHj7RnEONP8Rcsm4TKaEQIfFpmT6UcUbea9xv8xOgIyiyDg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602770581; 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=2GRj4YrjFOzYXZQlvDz76a9Pspc7KV7PGltAPb5Md7o=; b=j6exgjmflubT8MpWiM+bMPtAo+eJCj3KgGwJja2o1/ZuJLVS5z0OyxDIyd9h+T9ib68O/Xrqsanx6L2K90P9+oDmYd6kbc/hF80MEiNBj37mMerUSOlxa5KSin/+VHp6LTS+SIpYie9PD6R5KxY6qXC5F8xekg8iTD4HRBWKvaM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1602770581716372.9245315744653; Thu, 15 Oct 2020 07:03:01 -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-66-NAF6xrB6NKakaRHq5Q4QHg-1; Thu, 15 Oct 2020 10:02:56 -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 CBF438B7CD0; Thu, 15 Oct 2020 14:01:49 +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 A7BBC5CC26; Thu, 15 Oct 2020 14:01:49 +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 43D1058116; Thu, 15 Oct 2020 14:01:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 09FE0HTd002776 for ; Thu, 15 Oct 2020 10:00:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3610D5C22D; Thu, 15 Oct 2020 14:00:17 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id AAFBF5C1BD for ; Thu, 15 Oct 2020 14:00:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1602770579; 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=2GRj4YrjFOzYXZQlvDz76a9Pspc7KV7PGltAPb5Md7o=; b=W54VLIXHWYcW1VjVxv0cae/lbZnBmoQM8riY1PcTirnu2vik0DBQZ1bdrwfJPyDBtWVEoI LsQPcjwMH4BK/uPETFG5+RLXyB0sCJ7oID+jC2pUwGdCRiJ4O7oXDmBaJL44yZWr96GikH t/UUBVw8RZqqLAI75G0b3hHUq1UQKCY= X-MC-Unique: NAF6xrB6NKakaRHq5Q4QHg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 5/5] hyperv: Simplify @memResource freeing in hypervDomainSetMemoryFlags() Date: Thu, 15 Oct 2020 16:00:10 +0200 Message-Id: <0ad330a1360f471d04e45999e0bfb403911d3a86.1602770344.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.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 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) Content-Type: text/plain; charset="utf-8" Now, that ownership transfer of hypervSetEmbeddedProperty() is clear, we can use automatic freeing of the hash table. Signed-off-by: Michal Privoznik --- src/hyperv/hyperv_driver.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index cae284db0b..9ec2b879fc 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -1735,7 +1735,7 @@ hypervDomainSetMemoryFlags(virDomainPtr domain, unsig= ned long memory, Msvm_VirtualSystemSettingData *vssd =3D NULL; Msvm_MemorySettingData *memsd =3D NULL; g_auto(virBuffer) eprQuery =3D VIR_BUFFER_INITIALIZER; - virHashTablePtr memResource =3D NULL; + g_autoptr(virHashTable) memResource =3D NULL; =20 virCheckFlags(0, -1); =20 @@ -1781,21 +1781,17 @@ hypervDomainSetMemoryFlags(virDomainPtr domain, uns= igned long memory, if (!memResource) goto cleanup; =20 - if (hypervSetEmbeddedProperty(memResource, "VirtualQuantity", memory_s= tr) < 0) { - hypervFreeEmbeddedParam(memResource); + if (hypervSetEmbeddedProperty(memResource, "VirtualQuantity", memory_s= tr) < 0) goto cleanup; - } =20 if (hypervSetEmbeddedProperty(memResource, "InstanceID", memsd->data.common->InstanceID) < 0) { - hypervFreeEmbeddedParam(memResource); goto cleanup; } =20 if (priv->wmiVersion =3D=3D HYPERV_WMI_VERSION_V1) { if (hypervAddEmbeddedParam(params, priv, "ResourceSettingData", &memResource, Msvm_MemorySettingData_Wm= iInfo) < 0) { - hypervFreeEmbeddedParam(memResource); goto cleanup; } =20 --=20 2.26.2