[FFmpeg-cvslog] lavc/v4l2_m2m: don't close the file descriptor we don't own

Pavel Koshevoy git at videolan.org
Mon Sep 2 20:29:04 EEST 2019


ffmpeg | branch: master | Pavel Koshevoy <pkoshevoy at gmail.com> | Mon Sep  2 00:34:35 2019 -0600| [6b57a294a32874c9cdc1de0310cbf1d693b4776f] | committer: Pavel Koshevoy

lavc/v4l2_m2m: don't close the file descriptor we don't own

ff_v4l2_m2m_create_context initialized V4L2m2mContext.fd to 0
which is a valid file descriptor value. Next ff_v4l2_m2m_codec_init
failed and v4l2_m2m_destroy_context closed file descriptor 0 even
though it didn't belong to V4L2m2mContext.

Signed-off-by: Pavel Koshevoy <pkoshevoy at gmail.com>

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

 libavcodec/v4l2_m2m.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/v4l2_m2m.c b/libavcodec/v4l2_m2m.c
index 427e165f58..ac583c811f 100644
--- a/libavcodec/v4l2_m2m.c
+++ b/libavcodec/v4l2_m2m.c
@@ -401,6 +401,7 @@ int ff_v4l2_m2m_create_context(AVCodecContext *avctx, V4L2m2mContext **s)
     priv->context->capture.num_buffers = priv->num_capture_buffers;
     priv->context->output.num_buffers  = priv->num_output_buffers;
     priv->context->self_ref = priv->context_ref;
+    priv->context->fd = -1;
 
     return 0;
 }



More information about the ffmpeg-cvslog mailing list