diff options
author | mdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-11-22 00:52:53 +0000 |
---|---|---|
committer | mdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-11-22 00:52:53 +0000 |
commit | c46484952ad23fca742f8e6add49d78bda702d58 (patch) | |
tree | ec00b0ca402f7e620e4d01ff9bbf300f04548b25 /MdeModulePkg/Universal/Console/ConSplitterDxe | |
parent | d777486198d8ec66e2f461a641d505f4063e1e5e (diff) | |
download | edk2-platforms-c46484952ad23fca742f8e6add49d78bda702d58.tar.xz |
Update to use ReallocatePool() from BaseMemoryLib
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6678 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Console/ConSplitterDxe')
-rw-r--r-- | MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c index 67052b20b3..746c27180f 100644 --- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c +++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c @@ -1749,8 +1749,6 @@ ConSplitterGrowBuffer ( IN OUT VOID **Buffer
)
{
- UINTN NewSize;
- UINTN OldSize;
VOID *Ptr;
//
@@ -1758,23 +1756,16 @@ ConSplitterGrowBuffer ( // copy the old buffer's content to the new-size buffer,
// then free the old buffer.
//
- OldSize = *Count * SizeOfCount;
*Count += CONSOLE_SPLITTER_CONSOLES_ALLOC_UNIT;
- NewSize = *Count * SizeOfCount;
-
- Ptr = AllocateZeroPool (NewSize);
+ Ptr = ReallocatePool (
+ SizeOfCount * ((*Count) - CONSOLE_SPLITTER_CONSOLES_ALLOC_UNIT),
+ SizeOfCount * (*Count),
+ *Buffer
+ );
if (Ptr == NULL) {
return EFI_OUT_OF_RESOURCES;
}
-
- CopyMem (Ptr, *Buffer, OldSize);
-
- if (*Buffer != NULL) {
- FreePool (*Buffer);
- }
-
*Buffer = Ptr;
-
return EFI_SUCCESS;
}
|