]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/Dhcp6Dxe/ComponentName.c
MdePkg/SmmIoLib: Add header file.
[mirror_edk2.git] / NetworkPkg / Dhcp6Dxe / ComponentName.c
index c7fd6075df92121eabe7481efdf37c83e8df74a6..ba612156a09f1001807eff58127731d258799848 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   UEFI Component Name(2) protocol implementation for Dhcp6 driver.\r
 \r
-  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2016, 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
@@ -259,7 +259,7 @@ UpdateName (
 {\r
   EFI_STATUS                       Status;\r
   EFI_DHCP6_MODE_DATA              Dhcp6ModeData;\r
-  CHAR16                           HandleName[64];\r
+  CHAR16                           *HandleName;\r
 \r
   if (Dhcp6 == NULL) {\r
     return EFI_INVALID_PARAMETER;\r
@@ -279,11 +279,21 @@ UpdateName (
   }\r
   \r
   if (Dhcp6ModeData.Ia == NULL) {\r
-    UnicodeSPrint (HandleName, sizeof (HandleName), L"DHCPv6 (No configured IA)");\r
+    HandleName = L"DHCPv6 (No configured IA)";\r
   } else {\r
-    StrnCpy (HandleName, mDhcp6ControllerName[Dhcp6ModeData.Ia->State], sizeof (HandleName) / sizeof (CHAR16) - 1);\r
+    if (Dhcp6ModeData.Ia->State > Dhcp6Rebinding) {\r
+      return EFI_DEVICE_ERROR;\r
+    }\r
+    HandleName = mDhcp6ControllerName[Dhcp6ModeData.Ia->State];\r
   }\r
-  \r
+\r
+  if (Dhcp6ModeData.Ia != NULL) {\r
+    FreePool (Dhcp6ModeData.Ia);\r
+  }\r
+  if (Dhcp6ModeData.ClientId != NULL) {\r
+    FreePool (Dhcp6ModeData.ClientId);\r
+  }\r
+\r
   Status = AddUnicodeString2 (\r
              "eng",\r
              gDhcp6ComponentName.SupportedLanguages,\r