From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,db434bb21154c2b2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-17 11:29:17 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newsfeed-west.nntpserver.com!hub1.meganetnews.com!nntpserver.com!falcon.america.net!eagle.america.net.POSTED!not-for-mail Message-ID: <3D35B792.9020407@otelco.net> From: Larry Hazel User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0rc2) Gecko/20020618 Netscape/7.0b1 X-Accept-Language: en,x-ns11F8K63r3NhQ,x-ns2r2e09O MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: unchecked_deallocation References: <7e428372.0207171007.6df0fdae@posting.google.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 17 Jul 2002 13:29:38 -0500 NNTP-Posting-Host: 66.0.32.230 X-Trace: eagle.america.net 1026930554 66.0.32.230 (Wed, 17 Jul 2002 14:29:14 EDT) NNTP-Posting-Date: Wed, 17 Jul 2002 14:29:14 EDT Organization: 24hoursupport.com Xref: archiver1.google.com comp.lang.ada:27200 Date: 2002-07-17T13:29:38-05:00 List-Id: Felix Engemann wrote: > Hi all, > > I'm just writing a generic double linked list package. > I want to implement a function destroy_list, wich should return null > and free the space. My question is: > > is all the space freed, if i set a pointer to the first node and then free the > space with free(pointer_to_first_node) > > or do i have to delete and free from node to node, in order to free all the > space ? > > Thanx Felix You must deallocate every node individually. Use a recursive procedure (not a function) to do this. Returning a null pointer serves no purpose. Larry