Re: Help : error warning: modified (chunk-) pointer

From: Kurtis D. Rader (krader_at_skepticism.us)
Date: 05/26/03


Date: Mon, 26 May 2003 11:43:34 -0700

On Mon, 26 May 2003 13:25:33 +0100, Craig wrote:

> Thank you for your comments, I did not use free to de-allocate the space.
> Now works perfectly. also going to "overhaul" the function.
>
> should have paid more attention to how malloc allocates memory etc.

Are you saying you simply removed the free() call? If so, all you've done
is hide the fact that your program is corrupting the malloc heap. Which
means your program still has a defect that can manifest itself in other
ways. I recommend you link your program against a debug malloc package such
as ElectricFence and actually fix whatever is wrong.



Relevant Pages

  • Re: Making malloc() fail -- stuck
    ... Michael Kerrisk wrote: ... Now malloc() may use sbrkor sbrkto allocate the ... I am not saying that the author was wrong when he wrote what ... I am also saying that you have to test the documentation to make sure ...
    (comp.unix.programmer)
  • Re: dynamically allocated memory
    ... >>> module from libc.a containing exit, malloc(), free, and fflush. ... >>references will be resolved by dl.so to the only implementation. ... I'm rather saying that you can have an executable with symbolic ... references which resolve to exported symbols in the same ...
    (comp.unix.programmer)
  • Re: malloc and realloc
    ... value you can pass to malloc. ... So what you seem to be saying is that there'll always be memory available ... I see all these people saying "you don't need to defend against foo, ...
    (comp.lang.c)
  • why is casting malloc a bad thing?
    ... I saw on a couple of recent posts people saying that casting the return ... value of malloc is bad, ...
    (comp.lang.c)
  • Re: malloc() and free() and linked list
    ... > I know there's been a lot of articles and posts because of this malloc ... Saying "crashed" isn't quite right. ... fault whereas what happened here is that malloc() simply failed to perform ... You can't assign to an array in C. ...
    (comp.lang.c)