]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/Ip6Dxe/ComponentName.c
NetworkPkg: Clean up source files
[mirror_edk2.git] / NetworkPkg / Ip6Dxe / ComponentName.c
index dc164269a82ea03deb942e0606d2a98d0a1912b5..e314f152070352c73e1dc208850042504ef1a2b8 100644 (file)
@@ -2,7 +2,7 @@
   Implementation of EFI_COMPONENT_NAME_PROTOCOL and\r
   EFI_COMPONENT_NAME2_PROTOCOL protocol.\r
 \r
-  Copyright (c) 2009 - 2012, 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
@@ -238,10 +238,10 @@ Ip6ComponentNameGetDriverName (
 \r
   @param  Ip6[in]                   A pointer to the EFI_IP6_PROTOCOL.\r
 \r
-  \r
+\r
   @retval EFI_SUCCESS               Update the ControllerNameTable of this instance successfully.\r
   @retval EFI_INVALID_PARAMETER     The input parameter is invalid.\r
-  \r
+\r
 **/\r
 EFI_STATUS\r
 UpdateName (\r
@@ -263,6 +263,32 @@ UpdateName (
   //\r
   Offset = 0;\r
   Status = Ip6->GetModeData (Ip6, &Ip6ModeData, NULL, NULL);\r
+  if (!EFI_ERROR (Status)) {\r
+    if (Ip6ModeData.AddressList != NULL) {\r
+      FreePool (Ip6ModeData.AddressList);\r
+    }\r
+\r
+    if (Ip6ModeData.GroupTable != NULL) {\r
+      FreePool (Ip6ModeData.GroupTable);\r
+    }\r
+\r
+    if (Ip6ModeData.RouteTable != NULL) {\r
+      FreePool (Ip6ModeData.RouteTable);\r
+    }\r
+\r
+    if (Ip6ModeData.NeighborCache != NULL) {\r
+      FreePool (Ip6ModeData.NeighborCache);\r
+    }\r
+\r
+    if (Ip6ModeData.PrefixTable != NULL) {\r
+      FreePool (Ip6ModeData.PrefixTable);\r
+    }\r
+\r
+    if (Ip6ModeData.IcmpTypeList != NULL) {\r
+      FreePool (Ip6ModeData.IcmpTypeList);\r
+    }\r
+  }\r
+\r
   if (!EFI_ERROR (Status) && Ip6ModeData.IsStarted) {\r
     Status = NetLibIp6ToStr (&Ip6ModeData.ConfigData.StationAddress, Address, sizeof(Address));\r
     if (EFI_ERROR (Status)) {\r
@@ -280,7 +306,7 @@ UpdateName (
     }\r
     UnicodeSPrint (\r
       HandleName + Offset,\r
-      sizeof(HandleName) - Offset,\r
+      sizeof(HandleName) - Offset * sizeof (CHAR16),\r
       L"DestinationAddress=%s)",\r
       Address\r
       );\r
@@ -294,7 +320,7 @@ UpdateName (
       FreeUnicodeStringTable (gIp6ControllerNameTable);\r
       gIp6ControllerNameTable = NULL;\r
   }\r
-  \r
+\r
   Status = AddUnicodeString2 (\r
              "eng",\r
              gIp6ComponentName.SupportedLanguages,\r
@@ -305,7 +331,7 @@ UpdateName (
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
-  \r
+\r
   return AddUnicodeString2 (\r
            "en",\r
            gIp6ComponentName2.SupportedLanguages,\r
@@ -395,7 +421,7 @@ Ip6ComponentNameGetControllerName (
 {\r
   EFI_STATUS                    Status;\r
   EFI_IP6_PROTOCOL              *Ip6;\r
-  \r
+\r
   //\r
   // Only provide names for child handles.\r
   //\r
@@ -404,7 +430,7 @@ Ip6ComponentNameGetControllerName (
   }\r
 \r
   //\r
-  // Make sure this driver produced ChildHandle \r
+  // Make sure this driver produced ChildHandle\r
   //\r
   Status = EfiTestChildHandle (\r
              ControllerHandle,\r