X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Recipient: djgpp AT delorie DOT com MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed; reply-type=original Message-id: From: Gisle Vanem To: djgpp AT delorie DOT com References: <261476b1-c137-495d-95df-a92075cd9960 AT googlegroups DOT com> <2245ebea-be44-4a40-8b2f-7ef5e0e67157 AT googlegroups DOT com> Subject: Re: DJGPP scandir and alphasort example code Date: Tue, 26 Mar 2013 16:46:34 +0100 X-Priority: 3 X-MSMail-priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5931 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Reply-To: djgpp AT delorie DOT com "RayeR" wrote: > App stack: [0009d688..0001d68c] Exceptn stack: [0001d59c..0001b65c] > > Call frame traceback EIPs: > 0x00004254 > 0x00001ffb > 0x00003cd4 > > C:\1sc> > > All directory from root was listed, it crashed after... I can verify this. Lookng at the code, it seems the author got really confused about his own use of pointers :-). The code around "struct dirent *(*namelist[])" in scandir() is rather messy even for a C-expert. Anyway, the last free in scandirtest.c should IMHO be: free(*namelist); and not 'free(namelist)' . --gv