Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
continue;\r
}\r
if ((stricmp (argv[0], "--hash") == 0)) {\r
continue;\r
}\r
if ((stricmp (argv[0], "--hash") == 0)) {\r
+ if (EnableHash == TRUE) {\r
+ //\r
+ // --hash already given in the option, ignore this one\r
+ //\r
+ argc --;\r
+ argv ++;\r
+ continue;\r
+ }\r
EnableHash = TRUE;\r
OpenSslCommand = "openssl";\r
OpenSslEnv = getenv("OPENSSL_PATH");\r
EnableHash = TRUE;\r
OpenSslCommand = "openssl";\r
OpenSslEnv = getenv("OPENSSL_PATH");\r
}\r
\r
ScratchBuffer = malloc (ScratchSize);\r
}\r
\r
ScratchBuffer = malloc (ScratchSize);\r
+ if (ScratchBuffer == NULL) {\r
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
UncompressedBuffer = malloc (UncompressedLength);\r
UncompressedBuffer = malloc (UncompressedLength);\r
- if ((ScratchBuffer == NULL) || (UncompressedBuffer == NULL)) {\r
+ if (UncompressedBuffer == NULL) {\r
+ free (ScratchBuffer);\r
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");\r
return EFI_OUT_OF_RESOURCES;\r
}\r
Status = DecompressFunction (\r
return EFI_OUT_OF_RESOURCES;\r
}\r
Status = DecompressFunction (\r