Date: Sun, 18 Jun 2000 06:27:56 +0600 (LKT) From: Kalum Somaratna aka Grendel X-Sender: kalum AT roadrunner DOT grendel DOT net To: Martell cc: djgpp AT delorie DOT com Subject: Re: free crashes In-Reply-To: <394BC51F.B6B956C1@ne.infi.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 On Sat, 17 Jun 2000, The awesome and feared Martell commented thusly, > 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?! The fact that you have written to memory beyond the amount allocated by malloc to the bmp.data buffer seems highly likely. this would overwrite information about the allocated buffer that free needs which is stored at the end and the beginning of the allocated buffer...so this would cause free to crash. So I would suggest that you check your code which writes to the allocated bmp.data structure and check for buffer overruns, stray pointers etc.. BTW you can get the same thing by trying to free the same pointer more than once too. The DJGPP FAQ has more information about your problem in section 9.2 . Grendel > Hi, I'm a signature virus. plz set me as your signature and help me spread :)