[FFmpeg-devel] [PATCH v1 2/2] libavformat/file: initilize the fd to -1 instead of 0(valid fd) in case unexpected file close
mypopy at gmail.com
mypopy at gmail.com
Thu Jul 11 06:16:49 EEST 2019
On Wed, Jul 10, 2019 at 11:11 PM Limin Wang <lance.lmwang at gmail.com> wrote:
>
>
> ping? I have developed code to use avio_open_dir function, after using avio_close_dir
> to release the resource, my ffmepg command will lost interact for the fd
> 0 is closed by avio_close_dir.
>
>
> On Tue, Jun 18, 2019 at 06:45:13PM +0800, lance.lmwang at gmail.com wrote:
> > From: Limin Wang <lance.lmwang at gmail.com>
> >
> > Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> > ---
> > libavformat/file.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/libavformat/file.c b/libavformat/file.c
> > index 08c7f8e6dd.. 40ae9ad2a8 100644
> > --- a/libavformat/file.c
> > +++ b/libavformat/file.c
> > @@ -274,6 +274,7 @@ static int file_open_dir(URLContext *h)
> > #if HAVE_LSTAT
> > FileContext *c = h->priv_data;
> >
> > + c->fd = -1;
I don't konw why need to change the fd , suppose we have a calling
sequence like file_open ahead of file_open_dir, can we leak a fd
resource ?
> > c->dir = opendir(h->filename);
> > if (!c->dir)
> > return AVERROR(errno);
> > --
> > 2.21.0
More information about the ffmpeg-devel
mailing list