diff mbox series

[FFmpeg-devel] libavcodec\v4l2_m2m.c: avcodec/v4l2_m2m: Check if the file descriptor is valid before closing//答复: 答复: [PATCH] avcodec/v4l2_m2m: close the invalid file descriptor -1 in function v4l2_m2m_destroy_context

Message ID 7e0573a80728473f8496972f1521df0c@huawei.com
State New
Headers show
Series [FFmpeg-devel] libavcodec\v4l2_m2m.c: avcodec/v4l2_m2m: Check if the file descriptor is valid before closing//答复: 答复: [PATCH] avcodec/v4l2_m2m: close the invalid file descriptor -1 in function v4l2_m2m_destroy_context | expand

Checks

Context Check Description
andriy/commit_msg_x86 warning The first line of the commit message is way too long.
yinshiyou/commit_msg_loongarch64 warning The first line of the commit message is way too long.
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/commit_msg_armv7_RPi4 warning The first line of the commit message is way too long.
andriy/make_armv7_RPi4 success Make finished
andriy/make_fate_armv7_RPi4 success Make fate finished

Commit Message

Wujian(Chin) June 27, 2022, 12:32 p.m. UTC
Fixes ticket #9507.

Signed-off-by: wujian_nanjing <wujian2@huawei.com>
---
 libavcodec/v4l2_m2m.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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

To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavcodec/v4l2_m2m.c b/libavcodec/v4l2_m2m.c
index 51932ba..9849360 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);