[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PuTTY Trouble

ahmad khalifa wrote:

ok, now im almost finished... just having some trouble with some realloc()s...

any hints ?
doing reallocs on terminal resize... reallocing a smaller buffer is ok,
but reallocing a bigger buffer gives me some assertion failure about
the mem block not being of the right type...
anyone know anything about that ?
btw, free() then malloc() does the same thing...
btw2, reallocing occurs when i resize the terminal window...


This can happen if the program is writing to memory that was not allocated to it. Usually memory management functions allocate a buffer and pad it with some signature. When this buffer is given back to free or realloc they check the signature to make sure that the program did not write to a region that is outside of the buffer size. If it finds that the signature is bad then it fires an assertion. Make sure that the program does not right outside the range of an allocated buffer.

Such problems are difficult to debug since the problem is detected after it has actually happened (at the point of free or realloc). Good luck!

Hope this helps.