diff mbox

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

Message ID 1563027777-17411-1-git-send-email-lance.lmwang@gmail.com
State New
Headers show

Commit Message

Lance Wang July 13, 2019, 2:22 p.m. UTC
From: Limin Wang <lance.lmwang@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@gmail.com>
---
 libavformat/avio.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Lance Wang Sept. 2, 2019, 1:50 p.m. UTC | #1
ping, have test with the example code.

On Sat, Jul 13, 2019 at 10:22:57PM +0800, lance.lmwang@gmail.com wrote:
> From: Limin Wang <lance.lmwang@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@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
>
diff mbox

Patch

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;