[FFmpeg-devel] 答复: [PATCH] avcodec/v4l2_m2m: close the invalid file descriptor -1 in function v4l2_m2m_destroy_context

Andriy Gelman andriy.gelman at gmail.com
Sun Jun 26 01:05:50 EEST 2022


Hi,

On Sat, 25. Jun 03:04, Wujian(Chin) wrote:
> Hi:
> Please review it.
> Thks!
> 
> -----邮件原件-----
> 发件人: Wujian(Chin) 
> 发送时间: 2022年6月15日 19:15
> 收件人: 'ffmpeg-devel at ffmpeg.org' <ffmpeg-devel at ffmpeg.org>
> 主题: [PATCH] avcodec/v4l2_m2m: close the invalid file descriptor -1 in function v4l2_m2m_destroy_context

Maybe this title would be better?
avcodec/v4l2_m2m: Check if the file descriptor is valid before closing

Mention the trac ticket in the commit message please.

> Signed-off-by: wujian_nanjing <wujian2 at huawei.com>

Remove the _?

> ---
>  libavcodec/v4l2_m2m.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/v4l2_m2m.c b/libavcodec/v4l2_m2m.c index 51932ba..4427b48 100644
> --- a/libavcodec/v4l2_m2m.c
> +++ b/libavcodec/v4l2_m2m.c
> @@ -251,7 +251,9 @@ 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);
> +

The patch change looks fine, but it doesn't apply.

Thanks,
-- 
Andriy


More information about the ffmpeg-devel mailing list