[FFmpeg-devel] [PATCH v2] libavformat/avio: Fix for the unexpected file close which will cause fd 0 is closed

Limin Wang lance.lmwang at gmail.com
Mon Sep 2 16:50:01 EEST 2019


ping, have test with the example code.

On Sat, Jul 13, 2019 at 10:22:57PM +0800, lance.lmwang at gmail.com wrote:
> From: Limin Wang <lance.lmwang at gmail.com>
> 
> By the code, is_connected is used to check file open or not, so after open_dir
> is done, we should not set is_connected to 1, it'll cause the function ffurl_closep 
> will invoke the url_close and cause unexpected file close.
> 
> Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> ---
>  libavformat/avio.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/libavformat/avio.c b/libavformat/avio.c
> index 663789e..8b52aa3 100644
> --- a/libavformat/avio.c
> +++ b/libavformat/avio.c
> @@ -560,7 +560,6 @@ int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary **options)
>      if (ret < 0)
>          goto fail;
>  
> -    h->is_connected = 1;
>      ctx->url_context = h;
>      *s = ctx;
>      return 0;
> -- 
> 2.6.4
> 


More information about the ffmpeg-devel mailing list