strange segfault
"Mario D. Santana" <[email protected]>
| Newsgroups | gmane.comp.gnome.gdome |
|---|---|
| Message-ID | <[email protected]> |
Hello. I'm working on a project that keeps an XML config file in memory,
so I thought I'd use gdome. Thank you all for making it!
There's some strange behavior, though, in certain cases. It's a library
I'm working on, and fairly robust tests work fine. But when I include the
library in an Apache module, I get a segfault. The backtrace and some
relevant code follows, in case that helps anyone.
After much trial and error, I found that a single, strategically placed
call to gdome_n_nodeName() makes the problem go away. Things seem to be
working now, but...
I have glib-1.2.10, libxml-2.4.19, and gdome-0.7.0.
Thanks again. Cheers!
mds
(gdb) bt
#0 0x4015220a in malloc () from /lib/libc.so.6
#1 0x40152074 in malloc () from /lib/libc.so.6
#2 0x407215f9 in g_malloc () from /usr/lib/libglib-1.2.so.0
#3 0x4065bc72 in gdome_xml_str_mkref_dup () from /usr/lib/libgdome.so.0
#4 0x406659df in gdome_xml_n_nodeName () from /usr/lib/libgdome.so.0
#5 0x4064e58e in gdome_n_nodeName () from /usr/lib/libgdome.so.0
#6 0x4025556f in _macs_cf_descend (key=0x40256546 "cookie_domain",
parent=0x81512c0) at config.c:151
#7 0x402551f2 in macs_get_config (key=0x4025650e "AUS") at config.c:86
#8 0x40254612 in macs_apxs_cfdirective (parms=0xbfffd7e0, mconfig=0x8095664,
cfname=0x81651f4 "/home/mds/src/macs/macs/config.xml")
at mod_macs_cfg_dir.c:44
#9 ...Apache stuff to call my configuration directive handler...
From config.c:
GdomeNode *_macs_cf_descend(const char *key, GdomeNode *parent) {
GdomeDOMString *dkey=NULL, *s=NULL;
GdomeNodeList *kids;
GdomeNode *n;
int i;
gdome_n_nodeName(parent,&_macs_cf_e); /* <--- gratuitous but necessary */
kids=gdome_n_childNodes(parent,&_macs_cf_e);
...
if (!n) { /* Miss. Search for default. */
dkey=gdome_str_mkref("default");
for (i=0; (n=gdome_nl_item(kids,i,&_macs_cf_e)); i++) {
s=gdome_n_nodeName(n,&_macs_cf_e); /* <--- LINE 151 */
if (gdome_str_equalIgnoreCase(dkey,s)) break; /* Hit. */
gdome_str_unref(s);
}
if (s) { gdome_str_unref(s); s=NULL; }
}
...
}
--
Be braver -- you can't cross a chasm in two small leaps.