From c46484952ad23fca742f8e6add49d78bda702d58 Mon Sep 17 00:00:00 2001 From: mdkinney Date: Sat, 22 Nov 2008 00:52:53 +0000 Subject: Update to use ReallocatePool() from BaseMemoryLib git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6678 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/Console/ConSplitterDxe/ConSplitter.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'MdeModulePkg/Universal/Console/ConSplitterDxe') 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; } -- cgit v1.2.3