diff options
author | Jiaxin Wu <jiaxin.wu@intel.com> | 2016-04-27 14:29:29 +0800 |
---|---|---|
committer | Jiaxin Wu <jiaxin.wu@intel.com> | 2016-04-28 16:28:04 +0800 |
commit | 59844e126614fc8275aab083fafa5818cde0901c (patch) | |
tree | c18eb3c7b49032c4314c6b2868a05f9844e51223 /NetworkPkg/HttpDxe | |
parent | b347a22aecbfac9aac47831fee9a30aa810d6d0b (diff) | |
download | edk2-platforms-59844e126614fc8275aab083fafa5818cde0901c.tar.xz |
NetworkPkg: Fix incorrect buffer free in HttpDxe
FragmentBuffer of each TcpWrap in HttpDxe should not be
freed in HttpTcpTokenCleanup(). This buffer points to
HttpMsg body actually, which is the responsibility of the
caller to allocate a buffer for Body.
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Diffstat (limited to 'NetworkPkg/HttpDxe')
-rw-r--r-- | NetworkPkg/HttpDxe/HttpProto.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c index 06f3bb6860..f3992edfdc 100644 --- a/NetworkPkg/HttpDxe/HttpProto.c +++ b/NetworkPkg/HttpDxe/HttpProto.c @@ -1837,45 +1837,45 @@ HttpTcpTokenCleanup ( Rx6Token = NULL;
if (HttpInstance->LocalAddressIsIPv6) {
- if (Wrap->TcpWrap.Rx6Token.CompletionToken.Event != NULL) {
- gBS->CloseEvent (Wrap->TcpWrap.Rx6Token.CompletionToken.Event);
- }
-
Rx6Token = &Wrap->TcpWrap.Rx6Token;
- if (Rx6Token->Packet.RxData->FragmentTable[0].FragmentBuffer != NULL) {
- FreePool (Rx6Token->Packet.RxData->FragmentTable[0].FragmentBuffer);
- Rx6Token->Packet.RxData->FragmentTable[0].FragmentBuffer = NULL;
+
+ if (Rx6Token->CompletionToken.Event != NULL) {
+ gBS->CloseEvent (Rx6Token->CompletionToken.Event);
+ Rx6Token->CompletionToken.Event = NULL;
}
- FreePool (Wrap);
- if (HttpInstance->Rx6Token.CompletionToken.Event != NULL) {
- gBS->CloseEvent (HttpInstance->Rx6Token.CompletionToken.Event);
- HttpInstance->Rx6Token.CompletionToken.Event = NULL;
- }
+ FreePool (Wrap);
Rx6Token = &HttpInstance->Rx6Token;
+
+ if (Rx6Token->CompletionToken.Event != NULL) {
+ gBS->CloseEvent (Rx6Token->CompletionToken.Event);
+ Rx6Token->CompletionToken.Event = NULL;
+ }
+
if (Rx6Token->Packet.RxData->FragmentTable[0].FragmentBuffer != NULL) {
FreePool (Rx6Token->Packet.RxData->FragmentTable[0].FragmentBuffer);
Rx6Token->Packet.RxData->FragmentTable[0].FragmentBuffer = NULL;
}
} else {
- if (Wrap->TcpWrap.Rx4Token.CompletionToken.Event != NULL) {
- gBS->CloseEvent (Wrap->TcpWrap.Rx4Token.CompletionToken.Event);
- }
Rx4Token = &Wrap->TcpWrap.Rx4Token;
- if (Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer != NULL) {
- FreePool (Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer);
- Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer = NULL;
+
+ if (Rx4Token->CompletionToken.Event != NULL) {
+ gBS->CloseEvent (Rx4Token->CompletionToken.Event);
+ Rx4Token->CompletionToken.Event = NULL;
}
+
FreePool (Wrap);
- if (HttpInstance->Rx4Token.CompletionToken.Event != NULL) {
- gBS->CloseEvent (HttpInstance->Rx4Token.CompletionToken.Event);
- HttpInstance->Rx4Token.CompletionToken.Event = NULL;
+ Rx4Token = &HttpInstance->Rx4Token;
+
+ if (Rx4Token->CompletionToken.Event != NULL) {
+ gBS->CloseEvent (Rx4Token->CompletionToken.Event);
+ Rx4Token->CompletionToken.Event = NULL;
}
- Rx4Token = &HttpInstance->Rx4Token;
+
if (Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer != NULL) {
FreePool (Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer);
Rx4Token->Packet.RxData->FragmentTable[0].FragmentBuffer = NULL;
|