]> git.alsa-project.org Git - alsa-lib.git/commitdiff
rawmidi: free framing read bufffer when the framing mode becomes inactive
authorJaroslav Kysela <perex@perex.cz>
Tue, 5 Oct 2021 12:54:59 +0000 (14:54 +0200)
committerJaroslav Kysela <perex@perex.cz>
Thu, 28 Oct 2021 06:40:20 +0000 (08:40 +0200)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/rawmidi/rawmidi_hw.c

index 390271a459495076861195073863ed3e32447f54..9ffa31992607f4f0066f66b5e4215247f5b7070a 100644 (file)
@@ -114,6 +114,12 @@ static int snd_rawmidi_hw_params(snd_rawmidi_t *rmidi, snd_rawmidi_params_t * pa
                return -errno;
        }
        buf_reset(hw);
+       if (hw->buf &&
+           ((params->mode & SNDRV_RAWMIDI_MODE_FRAMING_MASK) != SNDRV_RAWMIDI_MODE_FRAMING_TSTAMP)) {
+               free(hw->buf);
+               hw->buf = NULL;
+               hw->buf_size = 0;
+       }
        return 0;
 }