From patchwork Fri Mar 27 16:04:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 46429 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 935CF215AE for ; Fri, 27 Mar 2015 16:05:44 +0000 (UTC) Received: by wgqa9 with SMTP id a9sf11881266wgq.2 for ; Fri, 27 Mar 2015 09:05:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:reply-to:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:errors-to:x-original-sender :x-original-authentication-results:mailing-list; bh=hT0M+xFbFNQvkESp4QiKs02T0xNomY1F4FqruhenRh4=; b=GnFMW0LBJ9Pn82DEvoYsFxQaxu6wRKW5YsELd8O/4CzAs6pTDN+GwCbvPepD6rpEv2 o00cDJZDg28nFq3BgeRr9TDJ7i7Q7IObZUThKhaq5MCFlBl96JfPn1cHyVxl2/Ugejq/ Q1qPbQ+5DBtdUyYX6lAc6Cr8br2y0D9m/LlQUMTJYAa9+jgNnyskmuJ7K77BY2W9mJFV 3Lq2y3QzWuzj7q7mnuHOe2uZyo/19CaiEQZfe2te5NgGwxlOSpJmNcZJPeppFelcOdjK GVs/Q+54EOys/dIvG6TSelHgtEA1ZEBMFG+yR3ISePVVtiq1IXHjlrk2JNMuT4a5PypN layw== X-Gm-Message-State: ALoCoQmi9hDJ7Fb4KiETh0o9nZIKP+HSS2KkJRmi1XdS5qEN1jks0fqpB0qUCmLhDuKqoJ1YVLIx X-Received: by 10.180.81.134 with SMTP id a6mr7043670wiy.1.1427472343930; Fri, 27 Mar 2015 09:05:43 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.163.36 with SMTP id yf4ls405596lab.43.gmail; Fri, 27 Mar 2015 09:05:43 -0700 (PDT) X-Received: by 10.112.12.134 with SMTP id y6mr18733235lbb.34.1427472343609; Fri, 27 Mar 2015 09:05:43 -0700 (PDT) Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com. [209.85.217.173]) by mx.google.com with ESMTPS id e8si447366lbc.134.2015.03.27.09.05.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Mar 2015 09:05:43 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) client-ip=209.85.217.173; Received: by lboc7 with SMTP id c7so10096477lbo.1 for ; Fri, 27 Mar 2015 09:05:43 -0700 (PDT) X-Received: by 10.112.29.36 with SMTP id g4mr10077470lbh.56.1427472343467; Fri, 27 Mar 2015 09:05:43 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.57.201 with SMTP id k9csp1354281lbq; Fri, 27 Mar 2015 09:05:42 -0700 (PDT) X-Received: by 10.107.16.31 with SMTP id y31mr29985248ioi.53.1427472341302; Fri, 27 Mar 2015 09:05:41 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id e15si2131709icn.44.2015.03.27.09.05.12 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 27 Mar 2015 09:05:41 -0700 (PDT) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YbWko-0004FS-PE; Fri, 27 Mar 2015 16:05:02 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YbWkn-0004Er-Bg for edk2-devel@lists.sourceforge.net; Fri, 27 Mar 2015 16:05:01 +0000 Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of linaro.org designates 209.85.212.176 as permitted sender) client-ip=209.85.212.176; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wi0-f176.google.com; Received: from mail-wi0-f176.google.com ([209.85.212.176]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1YbWkm-0004w7-9y for edk2-devel@lists.sourceforge.net; Fri, 27 Mar 2015 16:05:01 +0000 Received: by wiaa2 with SMTP id a2so37443930wia.0 for ; Fri, 27 Mar 2015 09:04:54 -0700 (PDT) X-Received: by 10.180.82.9 with SMTP id e9mr57751593wiy.88.1427472294314; Fri, 27 Mar 2015 09:04:54 -0700 (PDT) Received: from ards-macbook-pro.local ([90.174.5.29]) by mx.google.com with ESMTPSA id pm6sm4015898wic.20.2015.03.27.09.04.51 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 27 Mar 2015 09:04:53 -0700 (PDT) From: Ard Biesheuvel To: lersek@redhat.com, edk2-devel@lists.sourceforge.net Date: Fri, 27 Mar 2015 17:04:46 +0100 Message-Id: <1427472286-20051-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1427472286-20051-1-git-send-email-ard.biesheuvel@linaro.org> References: <1427472286-20051-1-git-send-email-ard.biesheuvel@linaro.org> X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1YbWkm-0004w7-9y Subject: [edk2] [PATCH 2/2] ArmPlatformPkg: fix two instances of FreePool () on NULL value X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.173 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 This is a copy/paste of the exact same code in both cases: Buffer should only be freed on the success path, otherwise it will be NULL Contributed-under: TianoCore Contribution Agreement 1.0 Reviewed-by: Ronald Cron Signed-off-by: Ard Biesheuvel --- ArmPlatformPkg/Bds/Bds.c | 2 +- ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ArmPlatformPkg/Bds/Bds.c b/ArmPlatformPkg/Bds/Bds.c index 971ab07524d7..6a12717a1c12 100644 --- a/ArmPlatformPkg/Bds/Bds.c +++ b/ArmPlatformPkg/Bds/Bds.c @@ -155,8 +155,8 @@ InitializeConsolePipe ( *Handle = Buffer[0]; Status = gBS->HandleProtocol (*Handle, Protocol, Interface); ASSERT_EFI_ERROR(Status); + FreePool (Buffer); } - FreePool (Buffer); } else { Status = EFI_SUCCESS; } diff --git a/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c b/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c index c07fc0f607d7..c010e8a0ce02 100644 --- a/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c +++ b/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c @@ -179,8 +179,8 @@ InitializeConsolePipe ( *Handle = Buffer[0]; Status = gBS->HandleProtocol (*Handle, Protocol, Interface); ASSERT_EFI_ERROR (Status); + FreePool (Buffer); } - FreePool (Buffer); } else { Status = EFI_SUCCESS; }