NetworkPkg: Enhance the NULL pointer check before dereference it.

This patch enhances the NULL pointer check of the HttpInstance->RemoteHost
pointer before dereference it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18482 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Fu Siyuan 2015-09-16 08:52:24 +00:00 committed by sfu5
parent c9e240316c
commit a8706acb0e
1 changed files with 2 additions and 1 deletions

View File

@ -316,7 +316,7 @@ EfiHttpRequest (
Configure = TRUE; Configure = TRUE;
ReConfigure = TRUE; ReConfigure = TRUE;
if (HttpInstance->RemoteHost == NULL && HttpInstance->RemotePort == 0) { if (HttpInstance->RemoteHost == NULL) {
// //
// Request() is called the first time. // Request() is called the first time.
// //
@ -373,6 +373,7 @@ EfiHttpRequest (
if (HttpInstance->RemoteHost != NULL) { if (HttpInstance->RemoteHost != NULL) {
FreePool (HttpInstance->RemoteHost); FreePool (HttpInstance->RemoteHost);
HttpInstance->RemoteHost = NULL; HttpInstance->RemoteHost = NULL;
HttpInstance->RemotePort = 0;
} }
} }
} }