summaryrefslogtreecommitdiff
path: root/libavcodec/v4l2_m2m.c
diff options
context:
space:
mode:
authorWujian(Chin) <wujian2@huawei.com>2022-06-28 11:15:12 +0000
committerSteven Liu <lq@chinaffmpeg.org>2022-07-01 09:59:48 +0800
commit26e7d7b14e7a3912aa0ce59ebab191a9c2d9edfa (patch)
treef056bf7b438ab891e8d419cba9d92ae0ce20bd7d /libavcodec/v4l2_m2m.c
parentbf13a177d2dd8be5287541d0115b303e861241ad (diff)
avcodec/v4l2_m2m: Check if the file descriptor is valid before closing
Fixes ticket #9507. Reviewed-by: Steven Liu <liuqi05@kuaishou.com> Signed-off-by: wujian_nanjing <wujian2@huawei.com>
Diffstat (limited to 'libavcodec/v4l2_m2m.c')
-rw-r--r--libavcodec/v4l2_m2m.c3
1 files changed, 2 insertions, 1 deletions
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);