tizen 2.3.1 release
[external/alsa-lib.git] / src / rawmidi / rawmidi_virt.c
index 52b8984..e5b17e4 100644 (file)
@@ -383,9 +383,11 @@ int snd_rawmidi_virtual_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
  _err:
        if (seq_handle)
                snd_seq_close(seq_handle);
-       if (virt->midi_event)
-               snd_midi_event_free(virt->midi_event);
-       free(virt);
+       if (virt) {
+               if (virt->midi_event)
+                       snd_midi_event_free(virt->midi_event);
+               free(virt);
+       }
        if (inputp)
                free(*inputp);
        if (outputp)