Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1oOP46-00005a-Rk for mharc-grub-devel@gnu.org; Wed, 17 Aug 2022 15:50:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOP43-0008Ln-38 for grub-devel@gnu.org; Wed, 17 Aug 2022 15:50:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:29131) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOP41-0002ow-J9 for grub-devel@gnu.org; Wed, 17 Aug 2022 15:50:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1660765853; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=E3whtM05Jd2MI2gB2DDxmn/8FUgOkwNZzYhr/U/cOZA=; b=OxWyVo3QDk81krYFw/tFl6YKA5aM75MvqM4/eiVbvaWXBTQ7FTxEmw/nLibavgb+gFJjFj NX05AO0wF/eN4MrMXsszEE6TIsZrzJkLz7rKqrvhIuP5rxuR3t/+UAAsdZ8IcVZUvICxQq cxAp6XRDO2ERPscvMlLC9b8ywwZD4xc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-498-EH3DFAngO4CkIlboHYpRNw-1; Wed, 17 Aug 2022 15:50:42 -0400 X-MC-Unique: EH3DFAngO4CkIlboHYpRNw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 21E31180F6E4; Wed, 17 Aug 2022 19:50:42 +0000 (UTC) Received: from eesha.redhat.com (unknown [10.22.33.251]) by smtp.corp.redhat.com (Postfix) with ESMTP id E3055492C3B; Wed, 17 Aug 2022 19:50:41 +0000 (UTC) From: Robbie Harwood To: grub-devel@gnu.org Cc: dkiper@net-space.pl, pmenzel@molgen.mpg.de, javierm@redhat.com, Robbie Harwood Subject: [PATCH v2 1/4] commands/efi/efifwsetup: Add missing grub_free()s Date: Wed, 17 Aug 2022 15:50:31 -0400 Message-Id: <20220817195034.265292-2-rharwood@redhat.com> In-Reply-To: <20220817195034.265292-1-rharwood@redhat.com> References: <20220817195034.265292-1-rharwood@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true Received-SPF: pass client-ip=170.10.133.124; envelope-from=rharwood@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2022 19:50:55 -0000 Each call of grub_efi_get_variable() needs a grub_free(). Signed-off-by: Robbie Harwood --- grub-core/commands/efi/efifwsetup.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/grub-core/commands/efi/efifwsetup.c b/grub-core/commands/efi/efifwsetup.c index eaca032838..b5b1f106c6 100644 --- a/grub-core/commands/efi/efifwsetup.c +++ b/grub-core/commands/efi/efifwsetup.c @@ -44,6 +44,8 @@ grub_cmd_fwsetup (grub_command_t cmd __attribute__ ((unused)), if (old_os_indications != NULL && oi_size == sizeof (os_indications)) os_indications |= *old_os_indications; + grub_free (old_os_indications); + status = grub_efi_set_variable ("OsIndications", &global, &os_indications, sizeof (os_indications)); if (status != GRUB_ERR_NONE) @@ -62,17 +64,20 @@ efifwsetup_is_supported (void) grub_efi_uint64_t *os_indications_supported = NULL; grub_size_t oi_size = 0; grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID; + grub_boolean_t ret = 0; grub_efi_get_variable ("OsIndicationsSupported", &global, &oi_size, (void **) &os_indications_supported); if (!os_indications_supported) - return 0; + goto done; if (*os_indications_supported & GRUB_EFI_OS_INDICATIONS_BOOT_TO_FW_UI) - return 1; + ret = 1; - return 0; + done: + grub_free (os_indications_supported); + return ret; } GRUB_MOD_INIT (efifwsetup) -- 2.35.1