Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!dptg!att!cbnewsl!dfp From: dfp@cbnewsl.ATT.COM (david.f.prosser) Newsgroups: comp.lang.c Subject: Re: What happens when realloc() returns NULL? Message-ID: <1707@cbnewsl.ATT.COM> Date: 31 Aug 89 15:23:59 GMT References: Reply-To: dfp@cbnewsl.ATT.COM (david.f.prosser) Organization: AT&T Bell Laboratories Lines: 14 In article tom@yang.cpac.washington.edu (Tom May) writes: >If I do this: > char *p1, *p2; > p1 = malloc (100); > p2 = realloc (p1, 200); >and malloc() returns non-NULL, but realloc() returns NULL, is the memory >pointed to by p1 still allocated? Section 4.10.3.4 (the realloc function), page 156, lines 23-24: "If the space cannot be allocated, the object pointed to by ptr [the first parameter] is unchanged." Dave Prosser ...not an official X3J11 answer...