From: Adam Miartus Date: Thu, 23 May 2019 09:44:30 +0000 (+0200) Subject: pcm: file: add missing unlock on early return X-Git-Tag: v1.2.1~73 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=33c7ea0865b7f87cef1c3d3e767734c0edd02e84;p=alsa-lib.git pcm: file: add missing unlock on early return Signed-off-by: Adam Miartus Signed-off-by: Takashi Iwai --- diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c index dcaa41d1..8e2c70b1 100644 --- a/src/pcm/pcm_file.c +++ b/src/pcm/pcm_file.c @@ -584,8 +584,10 @@ static snd_pcm_sframes_t snd_pcm_file_readi(snd_pcm_t *pcm, void *buffer, snd_pc __snd_pcm_lock(pcm); frames = _snd_pcm_readi(file->gen.slave, buffer, size); - if (frames <= 0) + if (frames <= 0) { + __snd_pcm_unlock(pcm); return frames; + } snd_pcm_areas_from_buf(pcm, areas, buffer); snd_pcm_file_areas_read_infile(pcm, areas, 0, frames); @@ -605,8 +607,10 @@ static snd_pcm_sframes_t snd_pcm_file_readn(snd_pcm_t *pcm, void **bufs, snd_pcm __snd_pcm_lock(pcm); frames = _snd_pcm_readn(file->gen.slave, bufs, size); - if (frames <= 0) + if (frames <= 0) { + __snd_pcm_unlock(pcm); return frames; + } snd_pcm_areas_from_bufs(pcm, areas, bufs); snd_pcm_file_areas_read_infile(pcm, areas, 0, frames);