🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2802

Re: realloc

#2802
From: Doug Gwyn
Date: Tue, 23 Apr 1991 20:18
8 lines
917 bytes
In article <1991Apr23.045937.178@Think.COM> barmar@think.com (Barry Margolin) writes:
>... the common practice of
>	fooptr = realloc (fooptr, newsize);
>results in a memory leak whenever realloc() returns a null pointer.

People who would write that code would probably also fail to test for a
null pointer being returned anyway, so they have a bigger problem than
memory leaks.  (Your suggested solution is fine.)
Technical Details
Message-ID: <15952@smoke.brl.mil>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!udel!haven.umd.edu!ncifcrf!lhc!adm!smoke!gwyn
References: <91112.102011LSC@SLACVM.SLAC.STANFORD.EDU> <1991Apr23.001451.14900@tkou02.enet.dec.com> <1991Apr23.045937.178@Think.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!udel!haven.umd.edu!ncifcrf!lhc!adm!smoke!gwyn
From: gwyn@smoke.brl.mil (Doug Gwyn)
Newsgroups: comp.std.c
Subject: Re: realloc
Message-ID: <15952@smoke.brl.mil>
Date: 23 Apr 91 20:18:07 GMT
References: <91112.102011LSC@SLACVM.SLAC.STANFORD.EDU> <1991Apr23.001451.14900@tkou02.enet.dec.com> <1991Apr23.045937.178@Think.COM>
Organization: U.S. Army Ballistic Research Laboratory, APG, MD.
Lines: 8