X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FC%2FVolInfo%2FVolInfo.c;h=2647cbb73a176c04b605f52ab661df272fa29438;hp=71917afa25f8f110e7dd3ef816011d209f0fb250;hb=a9b4ee43d31929fd616b06a301d2af6e0af7b647;hpb=7eb927db3e25afdda1a5c5458c54bb79afc5bc8f diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c index 71917afa25..2647cbb73a 100644 --- a/BaseTools/Source/C/VolInfo/VolInfo.c +++ b/BaseTools/Source/C/VolInfo/VolInfo.c @@ -1,7 +1,7 @@ /** @file The tool dumps the contents of a firmware volume -Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -2242,8 +2242,7 @@ Returns: { FILE *Fptr; CHAR8 Line[MAX_LINE_LEN]; - CHAR8 *FormatString; - INTN FormatLength; + CHAR8 FormatString[MAX_LINE_LEN]; GUID_TO_BASENAME *GPtr; if ((Fptr = fopen (LongFilePath (FileName), "r")) == NULL) { @@ -2254,23 +2253,8 @@ Returns: // // Generate the format string for fscanf // - FormatLength = snprintf ( - NULL, - 0, - "%%%us %%%us", - (unsigned) sizeof (GPtr->Guid) - 1, - (unsigned) sizeof (GPtr->BaseName) - 1 - ) + 1; - - FormatString = (CHAR8 *) malloc (FormatLength); - if (FormatString == NULL) { - fclose (Fptr); - return EFI_OUT_OF_RESOURCES; - } - - snprintf ( + sprintf ( FormatString, - FormatLength, "%%%us %%%us", (unsigned) sizeof (GPtr->Guid) - 1, (unsigned) sizeof (GPtr->BaseName) - 1 @@ -2282,7 +2266,6 @@ Returns: // GPtr = malloc (sizeof (GUID_TO_BASENAME)); if (GPtr == NULL) { - free (FormatString); fclose (Fptr); return EFI_OUT_OF_RESOURCES; } @@ -2299,7 +2282,6 @@ Returns: } } - free (FormatString); fclose (Fptr); return EFI_SUCCESS; }