mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-12-29 11:08:38 -05:00
NULL check in mmap_begin()
This commit is contained in:
parent
0d1fc81692
commit
cb1f308ab5
1 changed files with 5 additions and 1 deletions
|
|
@ -5955,8 +5955,12 @@ int snd_pcm_mmap_begin(snd_pcm_t *pcm,
|
||||||
snd_pcm_uframes_t cont;
|
snd_pcm_uframes_t cont;
|
||||||
snd_pcm_uframes_t f;
|
snd_pcm_uframes_t f;
|
||||||
snd_pcm_uframes_t avail;
|
snd_pcm_uframes_t avail;
|
||||||
|
const snd_pcm_channel_area_t *xareas;
|
||||||
assert(pcm && areas && offset && frames);
|
assert(pcm && areas && offset && frames);
|
||||||
*areas = snd_pcm_mmap_areas(pcm);
|
xareas = snd_pcm_mmap_areas(pcm);
|
||||||
|
if (xareas == NULL)
|
||||||
|
return -EBADFD;
|
||||||
|
*areas = xareas;
|
||||||
*offset = *pcm->appl.ptr % pcm->buffer_size;
|
*offset = *pcm->appl.ptr % pcm->buffer_size;
|
||||||
avail = snd_pcm_mmap_avail(pcm);
|
avail = snd_pcm_mmap_avail(pcm);
|
||||||
if (avail > pcm->buffer_size)
|
if (avail > pcm->buffer_size)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue