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

Re: [MiNT] windom and gcc4



Miro Kropacek wrote:
I have seen too that Zview crash before quit, this is true now I try to
remember I never find why, it is possible that it is when unload ldg,
personnaly as I not unload ldg with this function for my application I never
see it. I can try to find this bug in some days.


I know where the bug is I just don't know why it happens, it seems like
incorrect allocation in the first place, ldg_unload:

if( ldg) {
        if( ldg->close) (*ldg->close)();
        Mfree( ((BASPAG *)ldg->baspag)->p_env);
        Mfree( ldg->baspag);
        ldg->baspag = NULL;
        }

crash occurs on the last line, ldg->baspage = NULL (!), if I comment this
out, everything is OK. It seems that Mfree() frees more than it should (i.e.
freeing also the memory where 'ldg' points to)


What if ldg points to something in the freed area?
Maybe ldg itself is the pointer the the Malloc'd area.
Maybe baspag is the first member of the struct.
In which case ldg and ldg->baspag point to the same address :-)

Just a possibility.
Find the Malloc.

--
Groeten; Regards.
Henk Robbers. http://members.chello.nl/h.robbers
Interactive disassembler: TT-Digger;  http://digger.atari.org
A Home Cooked C compiler:      AHCC;  http://ahcc.atari.org