Imported Upstream version 1.0.29
[platform/upstream/alsa-lib.git] / src / rawmidi / rawmidi.c
index 0bd6b96..ac699b4 100644 (file)
@@ -63,7 +63,7 @@ contents of written buffer - passed by snd_rawmidi_write() - atomically
 to output ring buffer in the kernel space. This flag also means that device
 is not opened exclusively, so more applications can share given rawmidi device.
 Note that applications must send the whole MIDI message including the running status,
-because another writting application might break the MIDI message in the output
+because another writing application might break the MIDI message in the output
 buffer.
 
 \subsection rawmidi_open_sync Sync open (flag)
@@ -256,8 +256,11 @@ static int snd_rawmidi_open_conf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp
                snd_config_delete(type_conf);
        if (err >= 0)
                err = open_func(inputp, outputp, name, rawmidi_root, rawmidi_conf, mode);
-       if (err < 0)
+       if (err < 0) {
+               if (h)
+                       snd_dlclose(h);
                return err;
+       }
        if (inputp) {
                (*inputp)->dl_handle = h; h = NULL;
                snd_rawmidi_params_default(*inputp, &params);