]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/Mtftp6Dxe/Mtftp6Support.c
MdeModulePkg/UefiBootManagerLib: Fix small LoadOptionToVariable leak
[mirror_edk2.git] / NetworkPkg / Mtftp6Dxe / Mtftp6Support.c
index c31fc9dc27707b88815b00088559ae993cfd6d23..282a9c8e4942e54dc385bc5e5038556c38b8ba62 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Mtftp6 support functions implementation.\r
 \r
-  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -223,7 +223,7 @@ Mtftp6RemoveBlockNum (
       *TotalBlock  = Num;\r
 \r
       if (Range->Round > 0) {\r
-        *TotalBlock += Range->Bound +  MultU64x32 ((UINT64) (Range->Round -1), (UINT32)(Range->Bound + 1)) + 1;\r
+        *TotalBlock += Range->Bound +  MultU64x32 (Range->Round - 1, (UINT32)(Range->Bound + 1)) + 1;\r
       }\r
 \r
       if (Range->Start > Range->Bound) {\r
@@ -319,6 +319,29 @@ Mtftp6GetMapping (
     Status = Udp6->GetModeData (Udp6, NULL, &Ip6Mode, NULL, NULL);\r
 \r
     if (!EFI_ERROR (Status)) {\r
+      if (Ip6Mode.AddressList != NULL) {\r
+        FreePool (Ip6Mode.AddressList);\r
+      }\r
+\r
+      if (Ip6Mode.GroupTable != NULL) {\r
+        FreePool (Ip6Mode.GroupTable);\r
+      }\r
+\r
+      if (Ip6Mode.RouteTable != NULL) {\r
+        FreePool (Ip6Mode.RouteTable);\r
+      }\r
+\r
+      if (Ip6Mode.NeighborCache != NULL) {\r
+        FreePool (Ip6Mode.NeighborCache);\r
+      }\r
+\r
+      if (Ip6Mode.PrefixTable != NULL) {\r
+        FreePool (Ip6Mode.PrefixTable);\r
+      }\r
+\r
+      if (Ip6Mode.IcmpTypeList != NULL) {\r
+        FreePool (Ip6Mode.IcmpTypeList);\r
+      }\r
 \r
       if  (Ip6Mode.IsConfigured) {\r
         //\r
@@ -515,7 +538,7 @@ Mtftp6SendRequest (
 \r
   Packet->OpCode = HTONS (Operation);\r
   BufferLength  -= sizeof (Packet->OpCode);\r
-  \r
+\r
   Cur            = Packet->Rrq.Filename;\r
   Status         = AsciiStrCpyS ((CHAR8 *) Cur, BufferLength, (CHAR8 *) Token->Filename);\r
   ASSERT_EFI_ERROR (Status);\r
@@ -532,17 +555,17 @@ Mtftp6SendRequest (
   for (Index = 0; Index < Token->OptionCount; ++Index) {\r
     OptionStrLength = AsciiStrLen ((CHAR8 *) Options[Index].OptionStr);\r
     ValueStrLength  = AsciiStrLen ((CHAR8 *) Options[Index].ValueStr);\r
-    \r
+\r
     Status          = AsciiStrCpyS ((CHAR8 *) Cur, BufferLength, (CHAR8 *) Options[Index].OptionStr);\r
     ASSERT_EFI_ERROR (Status);\r
     BufferLength   -= (UINT32) (OptionStrLength + 1);\r
     Cur            += OptionStrLength + 1;\r
-    \r
+\r
     Status          = AsciiStrCpyS ((CHAR8 *) Cur, BufferLength, (CHAR8 *) Options[Index].ValueStr);\r
     ASSERT_EFI_ERROR (Status);\r
     BufferLength   -= (UINT32) (ValueStrLength + 1);\r
     Cur            += ValueStrLength + 1;\r
-    \r
+\r
   }\r
 \r
   //\r