dlmisc: fix snd_plugin_dir locking for not DL_ORIGIN_AVAILABLE

Fixes: 8580c081c2 ("dlsym: add support for ALSA_PLUGIN_DIR environment variable")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2020-10-29 20:31:19 +01:00
parent ad8c8e5503
commit 1d993b37ab

View file

@ -46,7 +46,7 @@ static int snd_plugin_dir_set = 0;
static char *snd_plugin_dir = NULL; static char *snd_plugin_dir = NULL;
#endif #endif
#if defined(DL_ORIGIN_AVAILABLE) && defined(HAVE_LIBPTHREAD) #ifdef HAVE_LIBPTHREAD
static pthread_mutex_t snd_dlpath_mutex = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t snd_dlpath_mutex = PTHREAD_MUTEX_INITIALIZER;
static inline void snd_dlpath_lock(void) static inline void snd_dlpath_lock(void)
@ -440,12 +440,10 @@ void snd_dlobj_cache_cleanup(void)
free(c); free(c);
} }
snd_dlobj_unlock(); snd_dlobj_unlock();
#ifdef DL_ORIGIN_AVAILABLE
snd_dlpath_lock(); snd_dlpath_lock();
snd_plugin_dir_set = 0; snd_plugin_dir_set = 0;
free(snd_plugin_dir); free(snd_plugin_dir);
snd_plugin_dir = NULL; snd_plugin_dir = NULL;
snd_dlpath_unlock(); snd_dlpath_unlock();
#endif
} }
#endif #endif