/** @file\r
The tool dumps the contents of a firmware volume\r
\r
-Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
{\r
FILE *Fptr;\r
CHAR8 Line[MAX_LINE_LEN];\r
- CHAR8 *FormatString;\r
- INTN FormatLength;\r
+ CHAR8 FormatString[MAX_LINE_LEN];\r
GUID_TO_BASENAME *GPtr;\r
\r
if ((Fptr = fopen (LongFilePath (FileName), "r")) == NULL) {\r
//\r
// Generate the format string for fscanf\r
//\r
- FormatLength = snprintf (\r
- NULL,\r
- 0,\r
- "%%%us %%%us",\r
- (unsigned) sizeof (GPtr->Guid) - 1,\r
- (unsigned) sizeof (GPtr->BaseName) - 1\r
- ) + 1;\r
-\r
- FormatString = (CHAR8 *) malloc (FormatLength);\r
- if (FormatString == NULL) {\r
- fclose (Fptr);\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
-\r
- snprintf (\r
+ sprintf (\r
FormatString,\r
- FormatLength,\r
"%%%us %%%us",\r
(unsigned) sizeof (GPtr->Guid) - 1,\r
(unsigned) sizeof (GPtr->BaseName) - 1\r
//\r
GPtr = malloc (sizeof (GUID_TO_BASENAME));\r
if (GPtr == NULL) {\r
- free (FormatString);\r
fclose (Fptr);\r
return EFI_OUT_OF_RESOURCES;\r
}\r
}\r
}\r
\r
- free (FormatString);\r
fclose (Fptr);\r
return EFI_SUCCESS;\r
}\r