Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!usc!snorkelwacker!bu.edu!buengc!bph From: bph@buengc.BU.EDU (Blair P. Houghton) Newsgroups: comp.lang.c Subject: Re: free (NULL); Message-ID: <5798@buengc.BU.EDU> Date: 8 May 90 20:24:56 GMT References: <1194@wet.UUCP> Reply-To: bph@buengc.bu.edu (Blair P. Houghton) Followup-To: comp.lang.c Organization: Boston Univ. Col. of Eng. Lines: 19 In article <1194@wet.UUCP> noah@wet.UUCP (Noah Spurrier) writes: > >Is there anything wrong with freeing a NULL? pointer? I have a function that In ANSI C, doing `free(ptr)', "if ptr is a NULL pointer, no action occurs" (quoted from X3.159-1989). Most current free(3) manual pages seem to ignore this bit of semantics, though you might get stuck on things like "the argument to free is a pointer to a block of memory previously allocated by malloc()." ANSI instead says that if it doesn't match a *alloc'ed pointer it has undefined consequences, except of course for the explicit case where the pointer is NULL. --Blair "Let's get Mikey to program it. Yeah, he hates everything..."