fix: Handle malloc errors properly in pack.c
This commit is contained in:
parent
7339aeeae5
commit
bf52d9e321
@ -44,6 +44,12 @@ int main(int argc, char** argv)
|
|||||||
fseek(fp, 0, SEEK_SET);
|
fseek(fp, 0, SEEK_SET);
|
||||||
|
|
||||||
char* buf = malloc(length);
|
char* buf = malloc(length);
|
||||||
|
if (!buf)
|
||||||
|
{
|
||||||
|
perror("malloc");
|
||||||
|
exit_status = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
fread(buf, 1, length, fp);
|
fread(buf, 1, length, fp);
|
||||||
if (ferror(fp))
|
if (ferror(fp))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user