]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/HttpBootDxe/HttpBootImpl.c
NetworkPkg/HttpBootDxe: Avoid the potential memory leak when eror happen.
[mirror_edk2.git] / NetworkPkg / HttpBootDxe / HttpBootImpl.c
index 7f0616dafc065dd2db0b131078ee976848612c86..d4b46a6e4a0bac6315bea073cc5e2392ce713973 100644 (file)
@@ -122,8 +122,9 @@ HttpBootStart (
   UINTN                Index;\r
   EFI_STATUS           Status;\r
   CHAR8                *Uri;\r
-  \r
 \r
+  Uri = NULL;\r
+  \r
   if (Private == NULL || FilePath == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
@@ -154,6 +155,9 @@ HttpBootStart (
       //\r
       Status = HttpBootStop (Private);\r
       if (EFI_ERROR (Status)) {\r
+        if (Uri != NULL) {\r
+          FreePool (Uri);\r
+        }\r
         return Status;\r
       }\r
     } else {\r