OpenSolaris

Printable Version Enter a New Search
Bug ID 6444546
Synopsis ia_find_display has small memory leak / fails to cache
State 10-Fix Delivered:Verified (Fix available in build)
Category:Subcategory xserver:libx11
Keywords testcase
Responsible Engineer Alan Coopersmith
Reported Against
Duplicate Of
Introduced In
Commit to Fix snv_45
Fixed In snv_45
Release Fixed solaris_nevada(snv_45)
Related Bugs 6478492
Submit Date 28-June-2006
Last Update Date 16-January-2007
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!
Work Around
N/A
Comments
N/A