This patch updates the HTTP driver to initialize the local variable for NULL
and check the NULL 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>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
// Initializations\r
//\r
Url = NULL;\r
// Initializations\r
//\r
Url = NULL;\r
HostName = NULL;\r
RequestMsg = NULL;\r
HostNameStr = NULL;\r
HostName = NULL;\r
RequestMsg = NULL;\r
HostNameStr = NULL;\r
if (SizeofHeaders != 0) {\r
HeaderTmp = AllocateZeroPool (SizeofHeaders);\r
if (HeaderTmp == NULL) {\r
if (SizeofHeaders != 0) {\r
HeaderTmp = AllocateZeroPool (SizeofHeaders);\r
if (HeaderTmp == NULL) {\r
}\r
\r
CopyMem (HeaderTmp, Tmp, SizeofHeaders);\r
}\r
\r
CopyMem (HeaderTmp, Tmp, SizeofHeaders);\r
//\r
if (mHttpUtilities == NULL) {\r
Status = EFI_NOT_READY;\r
//\r
if (mHttpUtilities == NULL) {\r
Status = EFI_NOT_READY;\r
&HttpMsg->HeaderCount\r
);\r
if (EFI_ERROR (Status)) {\r
&HttpMsg->HeaderCount\r
);\r
if (EFI_ERROR (Status)) {\r
}\r
\r
FreePool (HttpHeaders);\r
}\r
\r
FreePool (HttpHeaders);\r
&HttpInstance->TimeoutEvent\r
);\r
if (EFI_ERROR (Status)) {\r
&HttpInstance->TimeoutEvent\r
);\r
if (EFI_ERROR (Status)) {\r
//\r
Status = gBS->SetTimer (HttpInstance->TimeoutEvent, TimerRelative, HTTP_RESPONSE_TIMEOUT * TICKS_PER_SECOND);\r
if (EFI_ERROR (Status)) {\r
//\r
Status = gBS->SetTimer (HttpInstance->TimeoutEvent, TimerRelative, HTTP_RESPONSE_TIMEOUT * TICKS_PER_SECOND);\r
if (EFI_ERROR (Status)) {\r
gBS->SetTimer (HttpInstance->TimeoutEvent, TimerCancel, 0);\r
\r
if (EFI_ERROR (Status)) {\r
gBS->SetTimer (HttpInstance->TimeoutEvent, TimerCancel, 0);\r
\r
if (EFI_ERROR (Status)) {\r
}\r
\r
FreePool (Wrap);\r
}\r
\r
FreePool (Wrap);\r
return Status;\r
\r
Error2:\r
return Status;\r
\r
Error2:\r
- NetMapInsertHead (&HttpInstance->TxTokens, ValueInItem->HttpToken, ValueInItem);\r
+ if (ValueInItem != NULL) {\r
+ NetMapInsertHead (&HttpInstance->TxTokens, ValueInItem->HttpToken, ValueInItem);\r
+ }\r
\r
Error:\r
HttpTcpTokenCleanup (Wrap);\r
\r
Error:\r
HttpTcpTokenCleanup (Wrap);\r