(__builtin_new): Avoid passing 0 to malloc.

From-SVN: r2267
This commit is contained in:
Richard Stallman 1992-09-28 13:43:23 +00:00
parent 560df144a9
commit bcea218548
1 changed files with 3 additions and 0 deletions

View File

@ -1209,6 +1209,9 @@ __builtin_new (sz)
{
void *p;
/* malloc (0) is unpredictable; avoid it. */
if (sz == 0)
sz = 1;
p = (void *) malloc (sz);
if (p == 0)
(*__new_handler) ();