From: Jaroslav Kysela Date: Mon, 27 Feb 2017 08:29:18 +0000 (+0100) Subject: pcm file plugin: handle snd_pcm_mmap_begin() error path in snd_pcm_file_mmap_commit() X-Git-Tag: v1.1.4~25 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=b96f6f47852aa145645fb8626d009ec532246e55;p=alsa-lib.git pcm file plugin: handle snd_pcm_mmap_begin() error path in snd_pcm_file_mmap_commit() --- diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c index 0363f849..80122515 100644 --- a/src/pcm/pcm_file.c +++ b/src/pcm/pcm_file.c @@ -593,11 +593,13 @@ static snd_pcm_sframes_t snd_pcm_file_mmap_commit(snd_pcm_t *pcm, const snd_pcm_channel_area_t *areas; snd_pcm_sframes_t result; - snd_pcm_mmap_begin(file->gen.slave, &areas, &ofs, &siz); - assert(ofs == offset && siz == size); - result = snd_pcm_mmap_commit(file->gen.slave, ofs, siz); - if (result > 0) - snd_pcm_file_add_frames(pcm, areas, ofs, result); + result = snd_pcm_mmap_begin(file->gen.slave, &areas, &ofs, &siz); + if (result >= 0) { + assert(ofs == offset && siz == size); + result = snd_pcm_mmap_commit(file->gen.slave, ofs, siz); + if (result > 0) + snd_pcm_file_add_frames(pcm, areas, ofs, result); + } return result; }