diff options
author | niruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-06-06 08:41:58 +0000 |
---|---|---|
committer | niruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-06-06 08:41:58 +0000 |
commit | 2d1f3dd497f343bc54b4a164d4e9f015ae04f7dc (patch) | |
tree | c898ba3e282ebeed9d8da62b66bdd43ef540acab /IntelFrameworkModulePkg/Library | |
parent | d6f19057f048bdb1afb84fb8dddcb6373c0b684f (diff) | |
download | edk2-platforms-2d1f3dd497f343bc54b4a164d4e9f015ae04f7dc.tar.xz |
Fix memory leak issues.
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13428 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg/Library')
-rw-r--r-- | IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c index 3d1ccf9dc2..a432fb24a4 100644 --- a/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c +++ b/IntelFrameworkModulePkg/Library/GenericBdsLib/BdsMisc.c @@ -825,6 +825,7 @@ BdsLibGetVariableAndSize ( //
Buffer = AllocateZeroPool (BufferSize);
if (Buffer == NULL) {
+ *VariableSize = 0;
return NULL;
}
//
@@ -832,10 +833,15 @@ BdsLibGetVariableAndSize ( //
Status = gRT->GetVariable (Name, VendorGuid, NULL, &BufferSize, Buffer);
if (EFI_ERROR (Status)) {
+ FreePool (Buffer);
BufferSize = 0;
+ Buffer = NULL;
}
}
+ ASSERT (((Buffer == NULL) && (BufferSize == 0)) ||
+ ((Buffer != NULL) && (BufferSize != 0))
+ );
*VariableSize = BufferSize;
return Buffer;
}
|