From: Jaroslav Kysela Date: Tue, 5 Oct 2021 12:54:59 +0000 (+0200) Subject: rawmidi: free framing read bufffer when the framing mode becomes inactive X-Git-Tag: v1.2.6~19 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=392d5b06f8134fe9b408ef1d44e3227762371b52;p=alsa-lib.git rawmidi: free framing read bufffer when the framing mode becomes inactive Signed-off-by: Jaroslav Kysela --- diff --git a/src/rawmidi/rawmidi_hw.c b/src/rawmidi/rawmidi_hw.c index 390271a4..9ffa3199 100644 --- a/src/rawmidi/rawmidi_hw.c +++ b/src/rawmidi/rawmidi_hw.c @@ -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; }