From: "Edmund Horner" Newsgroups: comp.os.msdos.djgpp References: <394BC51F DOT B6B956C1 AT ne DOT infi DOT net> Subject: Re: free crashes Lines: 21 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4029.2901 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4029.2901 Organization: Paradise Net Ltd. Customer Message-ID: <961305777.859051@shelley.paradise.net.nz> Cache-Post-Path: shelley.paradise.net.nz!unknown AT 203-96-148-30 DOT tnt0 DOT paradise DOT net DOT nz X-Cache: nntpcache 2.4.0b2 (see http://www.nntpcache.org/) Date: Sun, 18 Jun 2000 17:30:03 +1200 NNTP-Posting-Host: 203.96.152.26 X-Complaints-To: newsadmin AT xtra DOT co DOT nz X-Trace: news.xtra.co.nz 961305794 203.96.152.26 (Sun, 18 Jun 2000 17:23:14 NZST) NNTP-Posting-Date: Sun, 18 Jun 2000 17:23:14 NZST To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com we would need to know exactly how your bmp variable was created. are you using allegro, and is bmp a BITMAP variable? if so, it's better to use destroy_bitmap(), unless of course you're doing something really clev er. generally free() will work only if the pointer you're trying it on was created with malloc(). free() will only work once; afterwards, the pointer will be invalid and shouldn't be dereferenced. "Martell" wrote in message news:394BC51F DOT B6B956C1 AT ne DOT infi DOT net... > my program works fine, except when the line at the very end of my code > comes along: > > free(bmp.data); > > then it crashes. what in the world could cause this?! >