[comp.lang.c] Broken realloc

campbell@redsox.bsw.com (Larry Campbell) (01/27/91)

In article <23975:Jan2516:36:5891@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes:
-
-Some versions of realloc() return the original pointer rather than 0 if
-they run out of memory. So you have to code the malloc()/bcopy()/free()
-sequence yourself if you want error checking.

Really?  This is obviously Evil and Rude and Broken and should have been
Reported to the Proper Authorities.  I am curious, since we have to write
code for a lot of different platforms.  Do you know of any platforms that
have this particular bug?

-- 
Larry Campbell             The Boston Software Works, Inc., 120 Fulton Street
campbell@redsox.bsw.com    Boston, Massachusetts 02109 (USA)
      The U.S. Constitution may not be perfect, but it sure beats
      whatever we're using right now.

martin@mwtech.UUCP (Martin Weitzel) (01/30/91)

In article <23975:Jan2516:36:5891@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes:
>Some versions of realloc() return the original pointer rather than 0 if
>they run out of memory. So you have to code the malloc()/bcopy()/free()
>sequence yourself if you want error checking.

What? This sounds like a VERY serious bug (same as if malloc silently
returned less memory than requested if there's not enough).

On which major C-Implementation(s) does the problem exist and why wasn't
it fixed if it isn't "hearsay"?

I'm really concerned. PLEASE NAME THE IMPLEMENTATIONS. I want to avoid
environments where even the simplest (known) bugs aren't fixed!!
-- 
Martin Weitzel, email: martin@mwtech.UUCP, voice: 49-(0)6151-6 56 83