From: Jaroslav Kysela Date: Tue, 10 Apr 2001 08:26:38 +0000 (+0000) Subject: Added the check to avoid NULL pointer dereference in snd_pcm_areas_copy X-Git-Tag: v1.0.3~894 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=21cbbc6d0d47530d0cd68d23147f6ef45926a046;p=alsa-lib.git Added the check to avoid NULL pointer dereference in snd_pcm_areas_copy --- diff --git a/src/pcm/pcm_share.c b/src/pcm/pcm_share.c index 935f57c9..c5958dd2 100644 --- a/src/pcm/pcm_share.c +++ b/src/pcm/pcm_share.c @@ -865,10 +865,11 @@ static int snd_pcm_share_start(snd_pcm_t *pcm) snd_pcm_uframes_t cont = pcm->buffer_size - offset; if (cont < frames) frames = cont; - snd_pcm_areas_copy(pcm->running_areas, offset, - pcm->stopped_areas, xfer, - pcm->channels, frames, - pcm->format); + if (pcm->stopped_areas != NULL) + snd_pcm_areas_copy(pcm->running_areas, offset, + pcm->stopped_areas, xfer, + pcm->channels, frames, + pcm->format); xfer += frames; } snd_pcm_mmap_appl_forward(pcm, hw_avail);