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:
Claudio Matsuoka 2011-01-10 08:12:28 -02:00
parent 27cd08716a
commit fd06fbe143

View File

@ -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)