Revision: 13706
http://edk2.svn.sourceforge.net/edk2/?rev=13706&view=rev
Author: ydong10
Date: 2012-09-07 01:55:33 +0000 (Fri, 07 Sep 2012)
Log Message:
-----------
Fix always allocate memory issue.
Signed-off-by: Eric Dong <[email protected]>
Reviewed-by: Jaben Carsey <[email protected]>
Modified Paths:
--------------
trunk/edk2/ShellPkg/Library/UefiShellLib/UefiShellLib.c
Modified: trunk/edk2/ShellPkg/Library/UefiShellLib/UefiShellLib.c
===================================================================
--- trunk/edk2/ShellPkg/Library/UefiShellLib/UefiShellLib.c 2012-09-07
01:54:47 UTC (rev 13705)
+++ trunk/edk2/ShellPkg/Library/UefiShellLib/UefiShellLib.c 2012-09-07
01:55:33 UTC (rev 13706)
@@ -3142,11 +3142,13 @@
//
if (CurrentSize != NULL) {
NewSize = *CurrentSize;
- while (NewSize < (DestinationStartSize + (Count*sizeof(CHAR16)))) {
- NewSize += 2 * Count * sizeof(CHAR16);
+ if (NewSize < DestinationStartSize + (Count * sizeof(CHAR16))) {
+ while (NewSize < (DestinationStartSize + (Count*sizeof(CHAR16)))) {
+ NewSize += 2 * Count * sizeof(CHAR16);
+ }
+ *Destination = ReallocatePool(*CurrentSize, NewSize, *Destination);
+ *CurrentSize = NewSize;
}
- *Destination = ReallocatePool(*CurrentSize, NewSize, *Destination);
- *CurrentSize = NewSize;
} else {
*Destination = AllocateZeroPool((Count+1)*sizeof(CHAR16));
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits