delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/18/02:34:09

Date: Sun, 18 Jun 2000 06:27:56 +0600 (LKT)
From: Kalum Somaratna aka Grendel <kalum AT lintux DOT cx>
X-Sender: kalum AT roadrunner DOT grendel DOT net
To: Martell <crazy AT ne DOT infi DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: free crashes
In-Reply-To: <394BC51F.B6B956C1@ne.infi.net>
Message-ID: <Pine.LNX.4.21.0006180620400.1633-100000@roadrunner.grendel.net>
MIME-Version: 1.0
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

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
:)

- Raw text -


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