Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!hp4nl!orcenl!bengsig From: bengsig@oracle.nl (Bjorn Engsig) Newsgroups: comp.lang.c Subject: Re: Should I free strtok() results? Message-ID: <624@nlsun1.oracle.nl> Date: 10 Apr 90 14:17:31 GMT References: <6501@rouge.usl.edu> Reply-To: bengsig@oracle.nl (Bjorn Engsig) Organization: Oracle Europe, The Netherlands Lines: 12 Article <6501@rouge.usl.edu> by pcb@gator.cacs.usl.edu (Peter C. Bahrs) says: |The string functions that return pointers to memory, should their |results be freed? All string functions that are part of ANSI C (see K&R 2, appendix B3) do not allocate any memory, and therefore nothing should be freed (strtok is among these). Please note, that strdup is not among these (why isn't it in ANSI C?), and that you should free the memory returned by it when it is no longer in use. -- Bjorn Engsig, Domain: bengsig@oracle.nl, bengsig@oracle.com Path: uunet!mcsun!orcenl!bengsig