bug 116546
Derek Atkins
warlord at MIT.EDU
Sun Jul 27 16:09:40 CDT 2003
Matthew Vanecek <mevanecek at yahoo.com> writes:
> I'm not sure if we should free the data nodes or not. It doesn't seem
> to cause any problems, but that's not always a sure indicator of
> appropriateness, is it? =P I tried to reason through it a bit and
> somehow decided they should be freed. I think my thought was that since
> we are calling g_list_free(blist), and that g_list_free() doesn't free
> dynamically allocated node->data, we should do it explicitly. The
> original (as you can see), simply called g_list_free() on be->blist,
> which I guess is OK to leave that way...
>
> FWIW, g_free does allow a NULL argument.
It's not NULL that I'm worried about -- it's double-freeing the data.
The PG BE doesn't own the QofBook*, so it shouldn't destroy it. Even
worse, just g_free'ing it can do two things:
1) cause a double free, and
2) cause a memory leak.
-derek
--
Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
Member, MIT Student Information Processing Board (SIPB)
URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH
warlord at MIT.EDU PGP key available
More information about the gnucash-devel
mailing list