From nobody Sun Feb 8 20:53:37 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1646229412; cv=none; d=zohomail.com; s=zohoarc; b=Omw7B7Bufp2BWI+N6/cMcNoIwN23epn1ns/opdmv6FtwdfqXJO9di87Kqwk5Oa1dkRNgBodSln7Yf1x9xgJabb+NwRjLthapCEJ1NgpgGxb876JWGRVQv8p47R5zk5+DKZRk0zwH/d6WugJLQt4qKzhNauVHYVoYAk0IWCTRbt4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1646229412; 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=kAtxBHEmah4lwYdtGahbNLXWvadb1MD9LwLlzYHpJUs=; b=hj8elVYkl7qHpBRmpHEmPh+I/rQw6a6He8/0Kxrdd8UWVbXu71Ez06jeg8Mi+WN7Ir/yAZwSIVw8zUuELyR6rOAAX4AzX8ZuofoYNEFQJt83WJtB+HVxNVw/BraSMHMuw4BCvrV5vK3xNQQw72IdqCQgSa68KFpG13Abi+RnfqQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1646229412161371.1156303871411; Wed, 2 Mar 2022 05:56:52 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-217-WSf_R0tuPhuhBUFCOwyZIg-1; Wed, 02 Mar 2022 08:56:49 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C93AE8DCC44; Wed, 2 Mar 2022 13:56:42 +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 4A4F227BCC; Wed, 2 Mar 2022 13:56:42 +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 154B14EA37; Wed, 2 Mar 2022 13:56:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 222Duf8K018242 for ; Wed, 2 Mar 2022 08:56:41 -0500 Received: by smtp.corp.redhat.com (Postfix) id 44A9C83788; Wed, 2 Mar 2022 13:56:41 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9FD9383783 for ; Wed, 2 Mar 2022 13:56:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646229411; 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=kAtxBHEmah4lwYdtGahbNLXWvadb1MD9LwLlzYHpJUs=; b=Fm2PfHXrX019zJFtMhK+K6Vf7uuyiDDPKgBOFmEf9jzoMT/z1CpfMQBd1fs9XS0B9rMD61 14qlktcXgqeYthWiwXV73o13A4k+9UQUaabYJnJR0u4lhclGfhmrW5sAjLPtoDI2mR4u1A /deQuaS/bDqiffQpGoJz19ZtNjUlpeI= X-MC-Unique: WSf_R0tuPhuhBUFCOwyZIg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 19/23] virsh: cmdDesc: Use 'vshTempFile' type to simplify cleanup Date: Wed, 2 Mar 2022 14:55:18 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.84 on 10.5.11.23 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: 1646229413471100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa --- tools/virsh-domain.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index cac50dba51..dcf0f712f6 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -8335,7 +8335,6 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd) int type; char *desc =3D NULL; char *desc_edited =3D NULL; - char *tmp =3D NULL; char *tmpstr; const vshCmdOpt *opt =3D NULL; g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; @@ -8379,6 +8378,8 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd) } if (edit) { + g_autoptr(vshTempFile) tmp =3D NULL; + /* Create and open the temporary file. */ if (!(tmp =3D vshEditWriteToTempFile(ctl, desc))) goto cleanup; @@ -8439,10 +8440,6 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd) cleanup: VIR_FREE(desc_edited); VIR_FREE(desc); - if (tmp) { - unlink(tmp); - VIR_FREE(tmp); - } return ret; } --=20 2.35.1