snd_pcm_close() doesn't handle NULL correctly.

Signed-off-by: Lukasz Marek <lukasz.m.lu...@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

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to