Segmentation Fault in xaccFreeSplit
Matthew Vanecek
mevanecek at yahoo.com
Fri Jan 21 22:52:38 EST 2005
On Fri, 2005-01-21 at 21:09 -0600, Matthew Vanecek wrote:
> On Fri, 2005-01-21 at 11:37 -0800, Thomas Bushnell BSG wrote:
> > Derek Atkins <warlord at MIT.EDU> writes:
[snip]
> It's faulting on my P3 nowadays for some reason. I wasn't sure if it
> was a glibc thing or what. Quite annoying. I was wondering if someone
> could reproduce this on his/her machine, to see if it's my machine/setup
> or something else.
>
> I'm kinda skeptical about using the contents of a freed Split to see if
> the Split has been freed, though. What if something else has
> overwritten the freed memory? Why is that particular pointer guaranteed
> to still be == (char *)1 if the split is run through the function again?
Hmm, it was my debugging attempt causing the problem--can't *printf("%
s") on a char* field that's been set to (char *)1. So, while accessing
the potentially freed memory is dubious, the SEGV actually happens a few
lines down, and a file or two over, in the qof_entity_release()
function. My Bad(tm). For some reason, split->entity.e_type is NULL by
this point, and I don't think the CACHE_REMOVE(str) macro appreciates
that.
This crash is happening on exit, when you would expect the memory to be
freed.
PINFO("Fixing to release split entity for type: %s",
split->entity.e_type);
qof_entity_release (&split->entity);
causes this result:
Info: xaccFreeSplit(): Fixing to release split entity for type: (null)
CRASH!!!!!! (because qof_entity_release doesn't have an logging
statements...).
and the gdb bt revealed that some g_hash_something function burped on
the NULL value. Don't have time right now to recreate the bt (bedtime)
but I could probably get to it again on Sunday.
Is it permissible for split->entity.e_type to be NULL at this point in
the game (exiting, etc.)? It's probably something I've written causing
this, but when I save the Split, it's e_type is "Split", and then when I
exit, the e_type is NULL...
Thanks,
--
Matthew Vanecek
perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
********************************************************************************
For 93 million miles, there is nothing between the sun and my shadow except me.
I'm always getting in the way of something...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20050121/38360453/attachment.bin
More information about the gnucash-devel
mailing list