[FFmpeg-devel] [PATCH] lavd/alsa-audio-common: dont crash while closing not opened device
Lukasz Marek
lukasz.m.luki2 at gmail.com
Mon Dec 15 02:16:43 CET 2014
snd_pcm_close() doesn't handle NULL correctly.
Signed-off-by: Lukasz Marek <lukasz.m.luki2 at gmail.com>
---
libavdevice/alsa-audio-common.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libavdevice/alsa-audio-common.c b/libavdevice/alsa-audio-common.c
index b7f5313..fff21a1 100644
--- a/libavdevice/alsa-audio-common.c
+++ b/libavdevice/alsa-audio-common.c
@@ -303,7 +303,10 @@ av_cold int ff_alsa_close(AVFormatContext *s1)
av_freep(&s->reorder_buf);
if (CONFIG_ALSA_INDEV)
ff_timefilter_destroy(s->timefilter);
- snd_pcm_close(s->h);
+ if (s->h) {
+ snd_pcm_close(s->h);
+ s->h = NULL;
+ }
return 0;
}
--
1.9.1
More information about the ffmpeg-devel
mailing list