(__builtin_new): Avoid passing 0 to malloc.
From-SVN: r2267
This commit is contained in:
parent
560df144a9
commit
bcea218548
|
@ -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) ();
|
||||
|
|
Loading…
Reference in New Issue