libasound_la_LIBADD = control/libcontrol.la mixer/libmixer.la pcm/libpcm.la \
rawmidi/librawmidi.la timer/libtimer.la \
hwdep/libhwdep.la seq/libseq.la instr/libinstr.la \
- compat/libcompat.la -lm -ldl -lpthread
+ compat/libcompat.la -lm -ldl -lpthread
libasound_la_LDFLAGS = -version-info $(COMPATNUM)
LDFLAGS = -Wl,--version-script=Versions
err = ctl->ops->close(ctl);
if (ctl->name)
free(ctl->name);
+ if (ctl->dl_handle)
+ snd_dlclose(ctl->dl_handle);
free(ctl);
return err;
}
_err:
if (type_conf)
snd_config_delete(type_conf);
- return err >= 0 ? open_func(ctlp, name, ctl_root, ctl_conf, mode) : err;
+ if (err >= 0) {
+ err = open_func(ctlp, name, ctl_root, ctl_conf, mode);
+ if (err >= 0) {
+ (*ctlp)->dl_handle = h;
+ return 0;
+ } else {
+ snd_dlclose(h);
+ }
+ }
+ return err;
}
static int snd_ctl_open_noupdate(snd_ctl_t **ctlp, snd_config_t *root, const char *name, int mode)
struct _snd_ctl {
+ void *dl_handle;
char *name;
snd_ctl_type_t type;
snd_ctl_ops_t *ops;
*/
void *snd_dlopen(const char *name, int mode)
{
+ void *res;
+
#ifndef PIC
if (name == NULL)
return &snd_dlsym_start;
_err:
if (type_conf)
snd_config_delete(type_conf);
- return err >= 0 ? open_func(hwdep, name, hwdep_root, hwdep_conf, mode) : err;
+ if (err >= 0) {
+ err = open_func(hwdep, name, hwdep_root, hwdep_conf, mode);
+ if (err >= 0) {
+ (*hwdep)->dl_handle = h;
+ } else {
+ snd_dlclose(h);
+ }
+ }
+ return err;
}
static int snd_hwdep_open_noupdate(snd_hwdep_t **hwdep, snd_config_t *root, const char *name, int mode)
} snd_hwdep_ops_t;
struct _snd_hwdep {
+ void *dl_handle;
char *name;
snd_hwdep_type_t type;
int mode;
free(pcm->hw.link_dst);
if (pcm->appl.link_dst)
free(pcm->appl.link_dst);
+ if (pcm->dl_handle)
+ snd_dlclose(pcm->dl_handle);
free(pcm);
return 0;
}
_err:
if (type_conf)
snd_config_delete(type_conf);
- return err >= 0 ? open_func(pcmp, name, pcm_root, pcm_conf, stream, mode) : err;
+ if (err >= 0) {
+ err = open_func(pcmp, name, pcm_root, pcm_conf, stream, mode);
+ if (err >= 0) {
+ (*pcmp)->dl_handle = h;
+ return 0;
+ } else {
+ snd_dlclose(h);
+ }
+ }
+ return err;
}
static int snd_pcm_open_noupdate(snd_pcm_t **pcmp, snd_config_t *root,
} snd_pcm_fast_ops_t;
struct _snd_pcm {
+ void *dl_handle;
char *name;
snd_pcm_type_t type;
snd_pcm_stream_t stream;
if (err < 0)
return err;
if (inputp) {
+ (*inputp)->dl_handle = h; h = NULL;
snd_rawmidi_params_default(*inputp, ¶ms);
err = snd_rawmidi_params(*inputp, ¶ms);
assert(err >= 0);
}
if (outputp) {
+ (*outputp)->dl_handle = h;
snd_rawmidi_params_default(*outputp, ¶ms);
err = snd_rawmidi_params(*outputp, ¶ms);
assert(err >= 0);
return err;
if (rawmidi->name)
free(rawmidi->name);
+ if (rawmidi->dl_handle)
+ snd_dlclose(rawmidi->dl_handle);
free(rawmidi);
return 0;
}
} snd_rawmidi_ops_t;
struct _snd_rawmidi {
+ void *dl_handle;
char *name;
snd_rawmidi_type_t type;
snd_rawmidi_stream_t stream;