|
Description
|
Jim Litchfield was doing some testing with libumem to find memory leaks in Firefox/Thunderbird and his results included these:
CACHE LEAKED BUFCTL CALLER
0981cc10 1 098e9a28 libX11.so.4`ia_find_display+0x36
0981cc10 1 09872af8 libX11.so.4`ia_find_display+0x36
Checking the libX11 source for ia_find_display we see this:
static IAExtDisplayInfo *ia_find_display(Display *dpy)
{
IAExtDisplayInfo *di;
for (di = iaExtDisplayList ; di != NULL; di = di->next) {
if (di->display == dpy) {
return di;
}
}
/* Did not find on list, add new entry */
di = (IAExtDisplayInfo *) Xmalloc(sizeof(IAExtDisplayInfo));
if (di == NULL) { return NULL; }
di->display = dpy;
di->codes = XInitExtension(dpy, ia_extension_name);
di->next = iaExtDisplayList;
iaExtDisplayList = di->next;
XESetCloseDisplay(dpy, di->codes->extension, ia_close_display);
XESetErrorString(dpy, di->codes->extension, ia_error_string);
return di;
}
It's adding it to a linked list in a static global for future use - except that it's
not quite doing so... upon closer inspection it fails to add to the list:
di->next = iaExtDisplayList;
iaExtDisplayList = di->next;
The second line should be iaExtDisplayList = di to add the new entry to the head, not
just put the value back in the head that we read out of it... oops!
|