ffmpeg | branch: master | Wujian(Chin) <wuji...@huawei.com> | Tue Jun 28 
11:15:12 2022 +0000| [26e7d7b14e7a3912aa0ce59ebab191a9c2d9edfa] | committer: 
Steven Liu

avcodec/v4l2_m2m: Check if the file descriptor is valid before closing

Fixes ticket #9507.

Reviewed-by: Steven Liu <liuq...@kuaishou.com>
Signed-off-by: wujian_nanjing <wuji...@huawei.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=26e7d7b14e7a3912aa0ce59ebab191a9c2d9edfa
---

 libavcodec/v4l2_m2m.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/v4l2_m2m.c b/libavcodec/v4l2_m2m.c
index 51932baf84..984936004d 100644
--- a/libavcodec/v4l2_m2m.c
+++ b/libavcodec/v4l2_m2m.c
@@ -251,7 +251,8 @@ static void v4l2_m2m_destroy_context(void *opaque, uint8_t 
*context)
     ff_v4l2_context_release(&s->capture);
     sem_destroy(&s->refsync);
 
-    close(s->fd);
+    if (s->fd >= 0)
+        close(s->fd);
     av_frame_unref(s->frame);
     av_frame_free(&s->frame);
     av_packet_unref(&s->buf_pkt);

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to