OpenSslPath = OpenSslCommand;\r
} else {\r
OpenSslPath = malloc(strlen(OpenSslEnv)+strlen(OpenSslCommand)+1);\r
+ if (OpenSslPath == NULL) {\r
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");\r
+ return GetUtilityStatus ();\r
+ }\r
CombinePath(OpenSslEnv, OpenSslCommand, OpenSslPath);\r
}\r
if (OpenSslPath == NULL){\r
SectionHeaderLen = GetSectionHeaderLength((EFI_COMMON_SECTION_HEADER *)Ptr);\r
\r
SectionName = SectionNameToStr (Type);\r
- printf ("------------------------------------------------------------\n");\r
- printf (" Type: %s\n Size: 0x%08X\n", SectionName, (unsigned) SectionLength);\r
- free (SectionName);\r
+ if (SectionName != NULL) {\r
+ printf ("------------------------------------------------------------\n");\r
+ printf (" Type: %s\n Size: 0x%08X\n", SectionName, (unsigned) SectionLength);\r
+ free (SectionName);\r
+ }\r
\r
switch (Type) {\r
case EFI_SECTION_RAW:\r
strlen (ToolOutputFileName) +\r
1\r
);\r
+ if (SystemCommand == NULL) {\r
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
sprintf (\r
SystemCommand,\r
SystemCommandFormatString,\r
nFileLen = ftell(fp);\r
fseek(fp,0,SEEK_SET);\r
StrLine = malloc(nFileLen);\r
+ if (StrLine == NULL) {\r
+ fclose(fp);\r
+ free (SystemCommand);\r
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
fgets(StrLine, nFileLen, fp);\r
NewStr = strrchr (StrLine, '=');\r
printf (" SHA1: %s\n", NewStr + 1);\r
free (StrLine);\r
+ fclose(fp);\r
}\r
- fclose(fp);\r
}\r
remove(ToolInputFileName);\r
remove(ToolOutputFileName);\r
close(fd2);\r
#endif\r
\r
+ if ((ToolInputFile == NULL) || (ToolOutputFile == NULL)) {\r
+ if (ToolInputFile != NULL) {\r
+ free (ToolInputFile);\r
+ }\r
+ if (ToolOutputFile != NULL) {\r
+ free (ToolOutputFile);\r
+ }\r
+ free (ExtractionTool);\r
+\r
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
//\r
// Construction 'system' command string\r
//\r
strlen (ToolOutputFile) +\r
1\r
);\r
+ if (SystemCommand == NULL) {\r
+ free (ToolInputFile);\r
+ free (ToolOutputFile);\r
+ free (ExtractionTool);\r
+\r
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
sprintf (\r
SystemCommand,\r
SystemCommandFormatString,\r
);\r
remove (ToolOutputFile);\r
free (ToolOutputFile);\r
+ free (SystemCommand);\r
if (EFI_ERROR (Status)) {\r
Error (NULL, 0, 0004, "unable to read decoded GUIDED section", NULL);\r
return EFI_SECTION_ERROR;\r