From af00cab88d24a30466f0a90ca32f80bc6d2eba14 Mon Sep 17 00:00:00 2001 From: li-elvin Date: Mon, 1 Aug 2011 07:18:24 +0000 Subject: [PATCH] Put free the buffer GraphicsOutput.Mode in correct place. Signed-off-by: li-elvin Reviewed-by: niruiyu git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12065 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Csm/BiosThunk/VideoDxe/BiosVideo.c | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/BiosVideo.c b/IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/BiosVideo.c index 76591e7a47..f2ad95d9fc 100644 --- a/IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/BiosVideo.c +++ b/IntelFrameworkModulePkg/Csm/BiosThunk/VideoDxe/BiosVideo.c @@ -711,6 +711,19 @@ BiosVideoChildHandleInstall ( } if (EFI_ERROR (Status)) { + // + // Free GOP mode structure if it is not freed before + // VgaMiniPort does not need this structure any more + // + if (BiosVideoPrivate->GraphicsOutput.Mode != NULL) { + if (BiosVideoPrivate->GraphicsOutput.Mode->Info != NULL) { + FreePool (BiosVideoPrivate->GraphicsOutput.Mode->Info); + BiosVideoPrivate->GraphicsOutput.Mode->Info = NULL; + } + FreePool (BiosVideoPrivate->GraphicsOutput.Mode); + BiosVideoPrivate->GraphicsOutput.Mode = NULL; + } + // // Neither VBE nor the standard 640x480 16 color VGA mode are supported, so do // not produce the Graphics Output protocol. Instead, produce the VGA MiniPort Protocol. @@ -993,8 +1006,10 @@ BiosVideoDeviceReleaseResource ( if (BiosVideoPrivate->GraphicsOutput.Mode != NULL) { if (BiosVideoPrivate->GraphicsOutput.Mode->Info != NULL) { FreePool (BiosVideoPrivate->GraphicsOutput.Mode->Info); + BiosVideoPrivate->GraphicsOutput.Mode->Info = NULL; } FreePool (BiosVideoPrivate->GraphicsOutput.Mode); + BiosVideoPrivate->GraphicsOutput.Mode = NULL; } // // Free EDID discovered protocol occupied resource @@ -1634,14 +1649,6 @@ Done: BiosVideoPrivate->ModeData = NULL; BiosVideoPrivate->MaxMode = 0; } - if (BiosVideoPrivate->GraphicsOutput.Mode != NULL) { - if (BiosVideoPrivate->GraphicsOutput.Mode->Info != NULL) { - FreePool (BiosVideoPrivate->GraphicsOutput.Mode->Info); - BiosVideoPrivate->GraphicsOutput.Mode->Info = NULL; - } - FreePool (BiosVideoPrivate->GraphicsOutput.Mode); - BiosVideoPrivate->GraphicsOutput.Mode= NULL; - } if (EdidOverrideDataBlock != NULL) { FreePool (EdidOverrideDataBlock); }