Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!samsung!uunet!mcsun!hp4nl!phigate!ehviea!leo From: leo@ehviea.ine.philips.nl (Leo de Wit) Newsgroups: comp.lang.c Subject: Re: free (NULL); Keywords: free, boolean language Message-ID: <712@ehviea.ine.philips.nl> Date: 8 May 90 16:28:58 GMT References: <1194@wet.UUCP> <19461@duke.cs.duke.edu> Reply-To: leo@ehviea.UUCP (Leo de Wit) Organization: Philips I&E Eindhoven Lines: 26 In article <19461@duke.cs.duke.edu> drh@cs.duke.edu writes: |In article <1194@wet.UUCP> noah@wet.UUCP (Noah Spurrier) writes: |> |>Is there anything wrong with freeing a NULL? pointer? |> |>char *squirl() |>{ |> static char *test = NULL; |> free (test); |> test = (char *) malloc (100); |> return (test); |>} |> |>This function is run many times so iI do not want to protect it with an if |>because the if would only be useful for the first time it is run, after that |>it just eats up run time. | |1. Different implementation do different things with NULL pointers | passed to free(). I find it best to assume that it is illegal | to not give a null pointer to free(). I guess this states you cannot safely call free() ? :-) Leo.