public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Yao, Jiewen" <jiewen.yao@intel.com>
To: "Zeng, Star" <star.zeng@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [PATCH 2/2] MdePkg DxeHstiLib: Fix memory leak issue
Date: Mon, 17 Jul 2017 00:41:30 +0000	[thread overview]
Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503A97A3DF@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <1500022441-260844-3-git-send-email-star.zeng@intel.com>

Reviewed-by: Jiewen.yao@intel.com

> -----Original Message-----
> From: Zeng, Star
> Sent: Friday, July 14, 2017 4:54 PM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star <star.zeng@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>
> Subject: [PATCH 2/2] MdePkg DxeHstiLib: Fix memory leak issue
> 
> The Hsti returned from InternalHstiFindAip() and temporally
> allocated NewHsti need to be freed after used.
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>  MdePkg/Library/DxeHstiLib/HstiDxe.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/MdePkg/Library/DxeHstiLib/HstiDxe.c
> b/MdePkg/Library/DxeHstiLib/HstiDxe.c
> index c032a98647bf..58510766bb43 100644
> --- a/MdePkg/Library/DxeHstiLib/HstiDxe.c
> +++ b/MdePkg/Library/DxeHstiLib/HstiDxe.c
> @@ -1,6 +1,6 @@
>  /** @file
> 
> -  Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of the BSD
> License
>    which accompanies this distribution.  The full text of the license may be
> found at
> @@ -206,7 +206,7 @@ InternalHstiIsValidTable (
>      }
>    }
>    if (Index ==
> sizeof(Hsti->ImplementationID)/sizeof(Hsti->ImplementationID[0])) {
> -    DEBUG ((EFI_D_ERROR, "ImplementationID is no NUL CHAR\n"));
> +    DEBUG ((EFI_D_ERROR, "ImplementationID has no NUL CHAR\n"));
>      return FALSE;
>    }
> 
> @@ -416,6 +416,7 @@ InternalHstiRecordFeaturesVerified (
>                    Hsti,
>                    HstiSize
>                    );
> +  FreePool (Hsti);
>    return Status;
>  }
> 
> @@ -545,6 +546,8 @@ InternalHstiRecordErrorString (
>                    NewHsti,
>                    NewHstiSize
>                    );
> +  FreePool (Hsti);
> +  FreePool (NewHsti);
>    return Status;
>  }
> 
> --
> 2.7.0.windows.1



      reply	other threads:[~2017-07-17  0:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-14  8:53 [PATCH 0/2] Minor update to HSTI Star Zeng
2017-07-14  8:54 ` [PATCH 1/2] MdePkg Hsti.h: Update version info to 1.1a Star Zeng
2017-07-17  0:41   ` Yao, Jiewen
2017-07-14  8:54 ` [PATCH 2/2] MdePkg DxeHstiLib: Fix memory leak issue Star Zeng
2017-07-17  0:41   ` Yao, Jiewen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=74D8A39837DF1E4DA445A8C0B3885C503A97A3DF@shsmsx102.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox