From nobody Mon Feb 9 03:51:26 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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 (zohomail.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 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 1580207508810876.4509819814056; Tue, 28 Jan 2020 02:31:48 -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-27-ogDl9VqGOMSLvp-UuvZdow-1; Tue, 28 Jan 2020 05:31:45 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 54ADC8010E1; Tue, 28 Jan 2020 10:31:40 +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 BD6668E9E4; Tue, 28 Jan 2020 10:31:39 +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 5CF1F18089C8; Tue, 28 Jan 2020 10:31:36 +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 00SAVZCp013995 for ; Tue, 28 Jan 2020 05:31:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id 89A965C21A; Tue, 28 Jan 2020 10:31:35 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.43.2.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 145935C545 for ; Tue, 28 Jan 2020 10:31:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1580207507; 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=ZF//0AURjwoxj5gLfLpSqcjM3MVzNjgmaFIne4sTp28=; b=YgKetmDCPXvDorkgE8EajH0H9a/d9RgZOV0pjyhssQNXiDfTfLFwBinzL6n9QA4A+HHvoA JRnhNj2xMEtGJuDiRPIU340tqv7ZEgm7R36eI33Fd/2I3K4vJsv7wuMBpXbetN5v2ESHEB CNyLfVM5w1KQELzWy+AhuteVCErRFUE= From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 01/10] qemu: use g_auto in qemuExtTPMStartEmulator Date: Tue, 28 Jan 2020 11:31:17 +0100 Message-Id: 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.13 X-MC-Unique: ogDl9VqGOMSLvp-UuvZdow-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" Use the g_auto macros wherever possible to eliminate the cleanup section. Signed-off-by: J=C3=A1n Tomko Reviewed-by: Peter Krempa --- src/qemu/qemu_tpm.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c index 262e6c4f07..c2132250eb 100644 --- a/src/qemu/qemu_tpm.c +++ b/src/qemu/qemu_tpm.c @@ -794,12 +794,12 @@ qemuExtTPMStartEmulator(virQEMUDriverPtr driver, bool incomingMigration) { int ret =3D -1; - virCommandPtr cmd =3D NULL; + g_autoptr(virCommand) cmd =3D NULL; int exitstatus =3D 0; - char *errbuf =3D NULL; - virQEMUDriverConfigPtr cfg; + g_autofree char *errbuf =3D NULL; + g_autoptr(virQEMUDriverConfig) cfg =3D NULL; virDomainTPMDefPtr tpm =3D vm->def->tpm; - char *shortName =3D virDomainDefGetShortName(vm->def); + g_autofree char *shortName =3D virDomainDefGetShortName(vm->def); int cmdret =3D 0, timeout, rc; pid_t pid; =20 @@ -855,12 +855,6 @@ qemuExtTPMStartEmulator(virQEMUDriverPtr driver, ret =3D 0; =20 cleanup: - VIR_FREE(shortName); - VIR_FREE(errbuf); - virCommandFree(cmd); - - virObjectUnref(cfg); - return ret; =20 error: --=20 2.21.0