Do not use snd_dl*() functions, dev->activate can be NULL

This commit is contained in:
Jaroslav Kysela 2003-06-14 07:31:54 +00:00
parent dad3f82711
commit 8bf6c1e5e6

View file

@ -156,7 +156,7 @@ static void snd_pcm_ladspa_free_plugins(struct list_head *plugins)
while (!list_empty(plugins)) { while (!list_empty(plugins)) {
snd_pcm_ladspa_plugin_t *plugin = list_entry(plugins->next, snd_pcm_ladspa_plugin_t, list); snd_pcm_ladspa_plugin_t *plugin = list_entry(plugins->next, snd_pcm_ladspa_plugin_t, list);
if (plugin->dl_handle) if (plugin->dl_handle)
snd_dlclose(plugin->dl_handle); dlclose(plugin->dl_handle);
if (plugin->filename) if (plugin->filename)
free(plugin->filename); free(plugin->filename);
list_del(&plugin->list); list_del(&plugin->list);
@ -412,6 +412,7 @@ static int snd_pcm_ladspa_allocate_instances(snd_pcm_t *pcm, snd_pcm_ladspa_t *l
return -EINVAL; return -EINVAL;
} }
list_add_tail(&instance->list, &plugin->instances); list_add_tail(&instance->list, &plugin->instances);
if (plugin->desc->activate)
plugin->desc->activate(instance->handle); plugin->desc->activate(instance->handle);
if (plugin->policy == SND_PCM_LADSPA_POLICY_DUPLICATE) { if (plugin->policy == SND_PCM_LADSPA_POLICY_DUPLICATE) {
err = snd_pcm_ladspa_connect_plugin_duplicate(plugin, &plugin->input, instance, idx); err = snd_pcm_ladspa_connect_plugin_duplicate(plugin, &plugin->input, instance, idx);
@ -719,9 +720,9 @@ static int snd_pcm_ladspa_check_file(snd_pcm_ladspa_plugin_t * const plugin,
void *handle; void *handle;
assert(filename); assert(filename);
handle = snd_dlopen(filename, RTLD_LAZY); handle = dlopen(filename, RTLD_LAZY);
if (handle) { if (handle) {
LADSPA_Descriptor_Function fcn = (LADSPA_Descriptor_Function)snd_dlsym(handle, "ladspa_descriptor", SND_DLSYM_VERSION(SND_PCM_DLSYM_VERSION)); LADSPA_Descriptor_Function fcn = (LADSPA_Descriptor_Function)dlsym(handle, "ladspa_descriptor", SND_DLSYM_VERSION(SND_PCM_DLSYM_VERSION));
if (fcn) { if (fcn) {
long idx; long idx;
const LADSPA_Descriptor *d; const LADSPA_Descriptor *d;
@ -738,7 +739,7 @@ static int snd_pcm_ladspa_check_file(snd_pcm_ladspa_plugin_t * const plugin,
return 1; return 1;
} }
} }
snd_dlclose(handle); dlclose(handle);
} }
return -ENOENT; return -ENOENT;
} }