diff options
author | Fu Siyuan <siyuan.fu@intel.com> | 2015-09-15 05:39:28 +0000 |
---|---|---|
committer | hwu1225 <hwu1225@Edk2> | 2015-09-15 05:39:28 +0000 |
commit | d277707a56041fad7a99dd345e9d151b87bf0519 (patch) | |
tree | 81b1f60f3439d46acdf009c359e579e52fec08a5 /NetworkPkg/HttpDxe/HttpProto.c | |
parent | 1e4de20d3a2273df954f061561a43e2def3d313b (diff) | |
download | edk2-platforms-d277707a56041fad7a99dd345e9d151b87bf0519.tar.xz |
NetworkPkg: Avoid memory allocation for each HTTP message exchange.
This patch updates the HTTP driver to use a shared buffer for URL parsing to
avoid memory allocation for each HTTP request.
(Sync patch r18449 from main trunk.)
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/branches/UDK2015@18459 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'NetworkPkg/HttpDxe/HttpProto.c')
-rw-r--r-- | NetworkPkg/HttpDxe/HttpProto.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/NetworkPkg/HttpDxe/HttpProto.c b/NetworkPkg/HttpDxe/HttpProto.c index e8ce9879f3..99f907e10c 100644 --- a/NetworkPkg/HttpDxe/HttpProto.c +++ b/NetworkPkg/HttpDxe/HttpProto.c @@ -431,6 +431,12 @@ HttpInitProtocol ( goto ON_ERROR;
}
+ HttpInstance->Url = AllocateZeroPool (HTTP_URL_BUFFER_LEN);
+ if (HttpInstance->Url == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto ON_ERROR;
+ }
+
NetMapInit (&HttpInstance->TxTokens);
NetMapInit (&HttpInstance->RxTokens);
@@ -496,6 +502,11 @@ HttpCleanProtocol ( HttpInstance->MsgParser = NULL;
}
+ if (HttpInstance->Url != NULL) {
+ FreePool (HttpInstance->Url);
+ HttpInstance->Url = NULL;
+ }
+
NetMapClean (&HttpInstance->TxTokens);
NetMapClean (&HttpInstance->RxTokens);
|