Handle memory allocation errors
Exit with return code 1 if memory allocation fails instead of just issuing a warning and resume execution with bogus pointer values. Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
This commit is contained in:
parent
27cd08716a
commit
fd06fbe143
@ -71,10 +71,9 @@ char *ptr;
|
||||
ptr=(char *)malloc(size);
|
||||
if (ptr==NULL) {
|
||||
fprintf(stderr,"%s: Out of memory\n",myname);
|
||||
exit(1);
|
||||
}
|
||||
else {
|
||||
return(ptr);
|
||||
}
|
||||
return(ptr);
|
||||
}
|
||||
|
||||
int badsuffix(path,suffix)
|
||||
|
Loading…
x
Reference in New Issue
Block a user