grep - letting calloc() return NULL for 0 storage makes grep "" work
This commit is contained in:
parent
32f3d9842d
commit
5518fe9be1
1 changed files with 1 additions and 1 deletions
|
@ -516,7 +516,7 @@ grep_calloc(size_t nmemb, size_t size)
|
|||
{
|
||||
void *ptr;
|
||||
|
||||
if ((ptr = calloc(nmemb, size)) == NULL)
|
||||
if ((ptr = calloc(nmemb, size)) == NULL && (size > 0) && (nmemb > 0))
|
||||
err(2, "calloc");
|
||||
return ptr;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue