tag 611232 upstream
kthxbye

On Thu, Jan 27, 2011 at 02:31:34 +0100, Marc Lehmann wrote:

> The documentation for XrmSetDatabase says:
> 
>    "The database previously associated with the display (if any) is not
>    destroyed."
> 
> Consequently, to avoid memory leaks, rxvt-unicode uses this to replace it:
> 
>    XrmDestroyDatabase (XrmGetDatabase (dpy));
>    XrmSetDatabase (dpy, get_resources (true));
> 
> This works almost always. However, sometimes, some third-party library
> calls XGetDefault itself, and this causes the undocumented behaviour of
> freeing the resource database in XrmSetDatabase.
> 
>     LockDisplay(display);
>     /* destroy database if set up imlicitely by XGetDefault() */
>     if (display->db && (display->flags & XlibDisplayDfltRMDB)) {
>         XrmDestroyDatabase(display->db);
>         display->flags &= ~XlibDisplayDfltRMDB;
>     }
>     display->db = database;
>     UnlockDisplay(display);
> 
> This makes it basically impossible to both avoid a memory leak AND not
> crashing on a double free.
> 
> And either the manpage is wrong (which claims the database isn't freed) or
> the code.
> 
Can you report this upstream to xorg-de...@lists.x.org (and maybe also
http://bugs.freedesktop.org to make sure it's not lost)?

Thanks,
Julien

Attachment: signature.asc
Description: Digital signature

Reply via email to