OSDN Git Service

Fix doubly call of dlclose() in dlobj caching code
authorTakashi Iwai <tiwai@suse.de>
Mon, 15 Apr 2013 16:12:17 +0000 (18:12 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 15 Apr 2013 16:23:46 +0000 (18:23 +0200)
commite1e40c25535af35fa5cdf7ffc95a01fbff098ddd
treec18112f28c444485ce391dff25fd0b7089d26e04
parent812e4b0c5ba74fecb6e086cadeb10e19df0e1e88
Fix doubly call of dlclose() in dlobj caching code

When multiple dlobj_cache items point to the same dlobj, dlclose() may
be called wrongly multiple times when these items are cleared, because
we manage the dlobj_cache list as a flat list.  This results in a bad
segfault we've seen in openal-soft, for example.

For fixing this, we need the refcounting of dlobj itself.  But, in
this case, we don't have to manage yet another list,  since dlopen()
does a proper refcounting by itself.  That is, we can just call always
dlopen() at each time a new function is assigned, and also call
dlclose() for each released dlobj_cache item at cleanup.

Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=814250

Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/dlmisc.c