From nobody Mon Feb 9 10:49:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.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 205.139.110.120 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=1579882138; cv=none; d=zohomail.com; s=zohoarc; b=KhooVCsIkvQaBHUwHDRdMHWVbjxn+d4sOW7oygFAPuQ2wi+YwaIYTXNnc5KrFPYjnB0BveqD/sMErZgdj2G7USuSsRFxjOPQtC/WhMfG9NzJtO9OauA7iVChZP0M9NLjXAlozvHHbwng4qx6CimDh+pT5NmQrIYWQ/c7M+84PaI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579882138; 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=cNMis66UOEzv4bRaBWGatynqhPsfcuBHvcWFyx93wIo=; b=nKKzYWzJQfntWSFrXgVZAocrnCMkYqcD9gmvzENuVB9hVJPpn3B7lXtOR+YR5XezzyxS3hAhYBgGT0vbMYObuayvoZ5IDUY+QTYGq5BfbsPNeb5Ts+wjOR8JohQp5OB4Q9EBQpThDiFZwB4dDhqlzzSM8ezxpynxBRJCrKX2YgU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1579882138033723.5994321908419; Fri, 24 Jan 2020 08:08:58 -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-186-_G3Io7aaO0OF2OKEbX_CMw-1; Fri, 24 Jan 2020 11:08:54 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A673318B9F54; Fri, 24 Jan 2020 16:08:48 +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 84D5D5DDAA; Fri, 24 Jan 2020 16:08:48 +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 3BC781803C32; Fri, 24 Jan 2020 16:08:48 +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 00OG8kuK011900 for ; Fri, 24 Jan 2020 11:08:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id D32395C241; Fri, 24 Jan 2020 16:08:46 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5BC425C1B0 for ; Fri, 24 Jan 2020 16:08:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579882136; 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=cNMis66UOEzv4bRaBWGatynqhPsfcuBHvcWFyx93wIo=; b=c6WGsiYvDOYz1XJ8U0+5l5RxLRbvOUaAIUk6ALjVoUE6Js9cysWTibpg4d5qsyGwN0zEBu iZuhAkpKAvZkQ9RN75vR6jX1SYoH88gDFLn9WKdhTDvhZil4pcazDdbUcFGpNB+Cwfljb5 s7ShoDbweKErRjJaKcKVUmt6vQ9Q6tY= From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH v2 2/9] virsh: secret: Refactor cleanup in cmdSecretSetValue Date: Fri, 24 Jan 2020 17:08:34 +0100 Message-Id: <52640542020c1ba013987ff20a945c14ef062633.1579881978.git.pkrempa@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.14 X-MC-Unique: _G3Io7aaO0OF2OKEbX_CMw-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" Automatically clean the secret object and get rid of the cleanup label and 'ret' valiable. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrang=C3=A9 --- tools/virsh-secret.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c index 7123b10860..58c9a54af6 100644 --- a/tools/virsh-secret.c +++ b/tools/virsh-secret.c @@ -188,18 +188,17 @@ static const vshCmdOptDef opts_secret_set_value[] =3D= { static bool cmdSecretSetValue(vshControl *ctl, const vshCmd *cmd) { - virSecretPtr secret; + g_autoptr(virshSecret) secret =3D NULL; size_t value_size; const char *base64 =3D NULL; unsigned char *value; int res; - bool ret =3D false; if (!(secret =3D virshCommandOptSecret(ctl, cmd, NULL))) return false; if (vshCommandOptStringReq(ctl, cmd, "base64", &base64) < 0) - goto cleanup; + return false; value =3D g_base64_decode(base64, &value_size); @@ -209,14 +208,10 @@ cmdSecretSetValue(vshControl *ctl, const vshCmd *cmd) if (res !=3D 0) { vshError(ctl, "%s", _("Failed to set secret value")); - goto cleanup; + return false; } vshPrintExtra(ctl, "%s", _("Secret value set\n")); - ret =3D true; - - cleanup: - virshSecretFree(secret); - return ret; + return true; } /* --=20 2.24.1