Check for NULL return from malloc in es vertification code and print error if es verification fails

This commit is contained in:
Robert MacGregor 2016-03-12 17:36:50 -05:00
parent 9766df5f5b
commit 1a50ba665a

View File

@ -252,6 +252,10 @@ ESStatus GetESStatus()
return result; return result;
char* temporaryBuffer = (char*)malloc(length); char* temporaryBuffer = (char*)malloc(length);
if (!temporaryBuffer)
return ESStatus::Error;
fseek(_fInput, 0, SEEK_SET); fseek(_fInput, 0, SEEK_SET);
fread(temporaryBuffer, length, 1, _fInput); fread(temporaryBuffer, length, 1, _fInput);
fseek(_fInput, 0, SEEK_SET); fseek(_fInput, 0, SEEK_SET);
@ -398,6 +402,7 @@ int main(int argc, char *argv[])
case ESStatus::Error: case ESStatus::Error:
{ {
fclose(_fInput); fclose(_fInput);
printf("Ecc encountered an error during the es verification.\n");
return EXIT_FAILURE; return EXIT_FAILURE;
} }
} }