diff --git a/NetworkPkg/HttpBootDxe/HttpBootDhcp4.c b/NetworkPkg/HttpBootDxe/HttpBootDhcp4.c index a8cee04c25..421ce6eda4 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootDhcp4.c +++ b/NetworkPkg/HttpBootDxe/HttpBootDhcp4.c @@ -422,6 +422,9 @@ HttpBootParseDhcp4Packet ( if (!IsProxyOffer) { OfferType = IsDnsOffer ? HttpOfferTypeDhcpDns : HttpOfferTypeDhcpOnly; } else { + if (Cache4->UriParser != NULL) { + FreePool (Cache4->UriParser); + } return EFI_DEVICE_ERROR; } } diff --git a/NetworkPkg/HttpBootDxe/HttpBootImpl.c b/NetworkPkg/HttpBootDxe/HttpBootImpl.c index 7f0616dafc..d4b46a6e4a 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootImpl.c +++ b/NetworkPkg/HttpBootDxe/HttpBootImpl.c @@ -122,8 +122,9 @@ HttpBootStart ( UINTN Index; EFI_STATUS Status; CHAR8 *Uri; - + Uri = NULL; + if (Private == NULL || FilePath == NULL) { return EFI_INVALID_PARAMETER; } @@ -154,6 +155,9 @@ HttpBootStart ( // Status = HttpBootStop (Private); if (EFI_ERROR (Status)) { + if (Uri != NULL) { + FreePool (Uri); + } return Status; } } else {