Commit bcea2185 by Richard Stallman

(__builtin_new): Avoid passing 0 to malloc.

From-SVN: r2267
parent 560df144
...@@ -1209,6 +1209,9 @@ __builtin_new (sz) ...@@ -1209,6 +1209,9 @@ __builtin_new (sz)
{ {
void *p; void *p;
/* malloc (0) is unpredictable; avoid it. */
if (sz == 0)
sz = 1;
p = (void *) malloc (sz); p = (void *) malloc (sz);
if (p == 0) if (p == 0)
(*__new_handler) (); (*__new_handler) ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment