mirror of https://github.com/acidanthera/audk.git
Fix always allocate memory issue.
Signed-off-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13706 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
81634bfb53
commit
f480fdc0f9
|
@ -3142,11 +3142,13 @@ StrnCatGrow (
|
||||||
//
|
//
|
||||||
if (CurrentSize != NULL) {
|
if (CurrentSize != NULL) {
|
||||||
NewSize = *CurrentSize;
|
NewSize = *CurrentSize;
|
||||||
while (NewSize < (DestinationStartSize + (Count*sizeof(CHAR16)))) {
|
if (NewSize < DestinationStartSize + (Count * sizeof(CHAR16))) {
|
||||||
NewSize += 2 * 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 {
|
} else {
|
||||||
*Destination = AllocateZeroPool((Count+1)*sizeof(CHAR16));
|
*Destination = AllocateZeroPool((Count+1)*sizeof(CHAR16));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue