X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Received: by 10.224.157.1 with SMTP id z1mr8553911qaw.8.1364409121281; Wed, 27 Mar 2013 11:32:01 -0700 (PDT) X-Received: by 10.49.3.42 with SMTP id 10mr1505887qez.23.1364409121255; Wed, 27 Mar 2013 11:32:01 -0700 (PDT) Newsgroups: comp.os.msdos.djgpp Date: Wed, 27 Mar 2013 11:32:01 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse AT google DOT com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2.173.27.66; posting-account=v5xbdQoAAAAOGc9Ccc-kLZyobvPlN3Qr NNTP-Posting-Host: 2.173.27.66 References: <261476b1-c137-495d-95df-a92075cd9960 AT googlegroups DOT com> <2245ebea-be44-4a40-8b2f-7ef5e0e67157 AT googlegroups DOT com> <5f806b56-af98-4f72-8984-a944be9348a4 AT googlegroups DOT com> <6b49a77b-dcba-4c23-8a29-4ac0263e7713 AT googlegroups DOT com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: DJGPP scandir and alphasort example code From: Georg Potthast Injection-Date: Wed, 27 Mar 2013 18:32:01 +0000 Content-Type: text/plain; charset=ISO-8859-1 X-Received-Bytes: 2202 Bytes: 2419 Lines: 31 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id r2RIj2VG018152 Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Am Mittwoch, 27. März 2013 10:23:18 UTC+1 schrieb Martin Str|mberg: > Georg Potthast wrote: > > > Anyway below is what I wanted to post. Maybe someone can tell what is wrong with the glob() usage part. > > > > I don't know. I just want to warn you about your memory leak. > > > > > //dynamic tdir array allocation > > > static struct dirent *tdir; > > > tdir = (struct dirent*) calloc(cnt,sizeof(struct dirent)); > > > > I can't see where you free tdir. Memory leak. > > > > > > -- > > MartinS That variable is unused in this version of the code. You can remove tdir and it will still work. And thus remove the memory leak.