From patchwork Thu Mar 26 20:48:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 46392 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 916A421584 for ; Thu, 26 Mar 2015 20:49:05 +0000 (UTC) Received: by labcd2 with SMTP id cd2sf8350995lab.3 for ; Thu, 26 Mar 2015 13:49:04 -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: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=F6SpTfQQ+I3T/68ElHLLwXs6soO1S1bTNhIjJ/8ITm4=; b=Mivyt0MgI5/iVg5EEbbiQtU9Z2ulyyReIYJhCTeg7bd9JBhheB/4j5EYqPWfXT5H9x e55yWAQR0f29WRfZhhWffQUPFvGz/rGNJwgoCHaPyopk7FoS9WVMz4xgCnsabprIm7cd 7Gg8xSG/SgqXpg2d+QsKqcrCsCbQyMe+wVercUr0pMKmytEElDITwc5yeD39GormG2Nr lfo0OFYvgMang7CdXoPrmUuptDxndMoGMoerbn1q4Y6QdRV7SKIx0AJeWSfl90kgOurC OgGSmP43bUuZuGOmDk1yOdSN51ilahS5yiSfHiXb6z5a1d1ndQ0KokuITA37k24dX0vn VK0g== X-Gm-Message-State: ALoCoQlOPFySs2sdU+oK/892e8kBehhI4r8q83zikorBNiUunUtIcLOiEPLdUgk/zVKhUn4EtRvQ X-Received: by 10.180.91.76 with SMTP id cc12mr6019618wib.7.1427402944408; Thu, 26 Mar 2015 13:49:04 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.1.135 with SMTP id 7ls299891lam.8.gmail; Thu, 26 Mar 2015 13:49:04 -0700 (PDT) X-Received: by 10.112.210.230 with SMTP id mx6mr15170632lbc.64.1427402944156; Thu, 26 Mar 2015 13:49:04 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id p10si5475242lal.92.2015.03.26.13.49.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Mar 2015 13:49:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbbsy1 with SMTP id sy1so50084746lbb.1 for ; Thu, 26 Mar 2015 13:49:03 -0700 (PDT) X-Received: by 10.152.5.194 with SMTP id u2mr15064604lau.88.1427402943669; Thu, 26 Mar 2015 13:49:03 -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 k9csp852941lbq; Thu, 26 Mar 2015 13:49:02 -0700 (PDT) X-Received: by 10.107.5.131 with SMTP id 125mr23572099iof.88.1427402942173; Thu, 26 Mar 2015 13:49:02 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id ah8si5795358icc.59.2015.03.26.13.49.01 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 26 Mar 2015 13:49:02 -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-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YbEhs-0000jI-ME; Thu, 26 Mar 2015 20:48:48 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1YbEhs-0000jD-0I for edk2-devel@lists.sourceforge.net; Thu, 26 Mar 2015 20:48:48 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of linaro.org designates 209.85.212.171 as permitted sender) client-ip=209.85.212.171; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wi0-f171.google.com; Received: from mail-wi0-f171.google.com ([209.85.212.171]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1YbEho-0006Fj-Kd for edk2-devel@lists.sourceforge.net; Thu, 26 Mar 2015 20:48:47 +0000 Received: by wixm2 with SMTP id m2so20372765wix.0 for ; Thu, 26 Mar 2015 13:48:38 -0700 (PDT) X-Received: by 10.180.23.99 with SMTP id l3mr49788008wif.36.1427402918640; Thu, 26 Mar 2015 13:48:38 -0700 (PDT) Received: from ards-macbook-pro.local ([90.174.5.29]) by mx.google.com with ESMTPSA id r14sm490684wiv.13.2015.03.26.13.48.37 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Mar 2015 13:48:37 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.sourceforge.net, lersek@redhat.com Date: Thu, 26 Mar 2015 21:48:28 +0100 Message-Id: <1427402908-15652-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 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 -0.0 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1YbEho-0006Fj-Kd Subject: [edk2] [PATCH 1/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.177 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 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; }