delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2013/03/26/11:47:05

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
MIME-version: 1.0
Message-id: <D85EE936F5F24E8E8E2EA7C8C3FB79C5@dev.null>
From: Gisle Vanem <gvanem AT broadpark DOT no>
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" <glaux AT centrum DOT cz> 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019