From patchwork Tue Sep 10 20:14:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Langsdorf X-Patchwork-Id: 274038 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 19A7D2C0123 for ; Wed, 11 Sep 2013 06:23:09 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A7B824A087; Tue, 10 Sep 2013 22:23:06 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hZk82k-PJfdu; Tue, 10 Sep 2013 22:23:06 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0A0854A08B; Tue, 10 Sep 2013 22:22:46 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7EF944A062 for ; Tue, 10 Sep 2013 22:21:52 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wcPxG7BTckBn for ; Tue, 10 Sep 2013 22:21:46 +0200 (CEST) X-Greylist: delayed 397 seconds by postgrey-1.27 at theia; Tue, 10 Sep 2013 22:21:46 CEST X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from smtp149.dfw.emailsrvr.com (smtp149.dfw.emailsrvr.com [67.192.241.149]) by theia.denx.de (Postfix) with ESMTPS id 7E4504A060 for ; Tue, 10 Sep 2013 22:21:46 +0200 (CEST) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp31.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id B325B16012D for ; Tue, 10 Sep 2013 16:15:07 -0400 (EDT) X-Virus-Scanned: OK Received: from smtp125.ord1c.emailsrvr.com (smtp125.ord1c.emailsrvr.com [108.166.43.125]) by smtp31.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTPS id 92895160128 for ; Tue, 10 Sep 2013 16:15:07 -0400 (EDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp8.relay.ord1c.emailsrvr.com (SMTP Server) with ESMTP id 66D401A01BE; Tue, 10 Sep 2013 16:14:59 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp8.relay.ord1c.emailsrvr.com (Authenticated sender: mark.langsdorf-AT-calxeda.com) with ESMTPSA id 2F1CE1A01D0; Tue, 10 Sep 2013 16:14:59 -0400 (EDT) From: Mark Langsdorf To: u-boot@lists.denx.de Date: Tue, 10 Sep 2013 15:14:56 -0500 Message-Id: <1378844096-15259-1-git-send-email-mark.langsdorf@calxeda.com> X-Mailer: git-send-email 1.8.1.2 X-Mailman-Approved-At: Tue, 10 Sep 2013 22:22:42 +0200 Cc: Mark Langsdorf Subject: [U-Boot] [PATCH 1/6] part_efi: make sure the gpt_pte is freed X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de the gpt_pte wasn't being freed if it was checked against an invalid partition. The resulting memory leakage could make it impossible to repeatedly attempt to load non-existent files in a script. Also, downgrade the message for not finding an invalid partition from a printf() to a debug() so as to minimize message spam in perfectly normal situations. Signed-off-by: Mark Langsdorf --- disk/part_efi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/disk/part_efi.c b/disk/part_efi.c index b7524d6..9c33ae7 100644 --- a/disk/part_efi.c +++ b/disk/part_efi.c @@ -164,8 +164,9 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, int part, if (part > le32_to_cpu(gpt_head->num_partition_entries) || !is_pte_valid(&gpt_pte[part - 1])) { - printf("%s: *** ERROR: Invalid partition number %d ***\n", + debug("%s: *** ERROR: Invalid partition number %d ***\n", __func__, part); + free(gpt_pte); return -1; }