diff mbox series

[FFmpeg-devel] avformat/http: fix memleak

Message ID tencent_0970192DB09AC2405C9A409F66AB614E5B08@qq.com
State Accepted
Commit 90351b5f11079a86230f131d30df173d4c737676
Headers show
Series [FFmpeg-devel] avformat/http: fix memleak | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Zhao Zhili Aug. 23, 2020, 4:58 p.m. UTC
---
 libavformat/http.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Zhao Zhili Sept. 23, 2020, 6:10 p.m. UTC | #1
Ping for review.

> On Aug 24, 2020, at 12:58 AM, Zhao Zhili <quinkblack@foxmail.com> wrote:
> 
> ---
> libavformat/http.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/http.c b/libavformat/http.c
> index 6c39da1a8b..3d25d652d3 100644
> --- a/libavformat/http.c
> +++ b/libavformat/http.c
> @@ -577,7 +577,7 @@ static int http_open(URLContext *h, const char *uri, int flags,
>                    "No trailing CRLF found in HTTP header. Adding it.\n");
>             ret = av_reallocp(&s->headers, len + 3);
>             if (ret < 0)
> -                return ret;
> +                goto bail_out;
>             s->headers[len]     = '\r';
>             s->headers[len + 1] = '\n';
>             s->headers[len + 2] = '\0';
> @@ -588,6 +588,7 @@ static int http_open(URLContext *h, const char *uri, int flags,
>         return http_listen(h, uri, flags, options);
>     }
>     ret = http_open_cnx(h, options);
> +bail_out:
>     if (ret < 0)
>         av_dict_free(&s->chained_options);
>     return ret;
> -- 
> 2.25.1
>
Jun Zhao Sept. 24, 2020, 3:13 a.m. UTC | #2
On Thu, Sep 24, 2020 at 2:10 AM Zhao Zhili <quinkblack@foxmail.com> wrote:
>
> Ping for review.
>
> > On Aug 24, 2020, at 12:58 AM, Zhao Zhili <quinkblack@foxmail.com> wrote:
> >
> > ---
> > libavformat/http.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavformat/http.c b/libavformat/http.c
> > index 6c39da1a8b..3d25d652d3 100644
> > --- a/libavformat/http.c
> > +++ b/libavformat/http.c
> > @@ -577,7 +577,7 @@ static int http_open(URLContext *h, const char *uri, int flags,
> >                    "No trailing CRLF found in HTTP header. Adding it.\n");
> >             ret = av_reallocp(&s->headers, len + 3);
> >             if (ret < 0)
> > -                return ret;
> > +                goto bail_out;
> >             s->headers[len]     = '\r';
> >             s->headers[len + 1] = '\n';
> >             s->headers[len + 2] = '\0';
> > @@ -588,6 +588,7 @@ static int http_open(URLContext *h, const char *uri, int flags,
> >         return http_listen(h, uri, flags, options);
> >     }
> >     ret = http_open_cnx(h, options);
> > +bail_out:
> >     if (ret < 0)
> >         av_dict_free(&s->chained_options);
> >     return ret;
> > --
> > 2.25.1
> >
>
LGTM
Michael Niedermayer Sept. 24, 2020, 9:21 a.m. UTC | #3
On Thu, Sep 24, 2020 at 11:13:49AM +0800, mypopy@gmail.com wrote:
> On Thu, Sep 24, 2020 at 2:10 AM Zhao Zhili <quinkblack@foxmail.com> wrote:
> >
> > Ping for review.
> >
> > > On Aug 24, 2020, at 12:58 AM, Zhao Zhili <quinkblack@foxmail.com> wrote:
> > >
> > > ---
> > > libavformat/http.c | 3 ++-
> > > 1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/libavformat/http.c b/libavformat/http.c
> > > index 6c39da1a8b..3d25d652d3 100644
> > > --- a/libavformat/http.c
> > > +++ b/libavformat/http.c
> > > @@ -577,7 +577,7 @@ static int http_open(URLContext *h, const char *uri, int flags,
> > >                    "No trailing CRLF found in HTTP header. Adding it.\n");
> > >             ret = av_reallocp(&s->headers, len + 3);
> > >             if (ret < 0)
> > > -                return ret;
> > > +                goto bail_out;
> > >             s->headers[len]     = '\r';
> > >             s->headers[len + 1] = '\n';
> > >             s->headers[len + 2] = '\0';
> > > @@ -588,6 +588,7 @@ static int http_open(URLContext *h, const char *uri, int flags,
> > >         return http_listen(h, uri, flags, options);
> > >     }
> > >     ret = http_open_cnx(h, options);
> > > +bail_out:
> > >     if (ret < 0)
> > >         av_dict_free(&s->chained_options);
> > >     return ret;
> > > --
> > > 2.25.1
> > >
> >
> LGTM

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavformat/http.c b/libavformat/http.c
index 6c39da1a8b..3d25d652d3 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -577,7 +577,7 @@  static int http_open(URLContext *h, const char *uri, int flags,
                    "No trailing CRLF found in HTTP header. Adding it.\n");
             ret = av_reallocp(&s->headers, len + 3);
             if (ret < 0)
-                return ret;
+                goto bail_out;
             s->headers[len]     = '\r';
             s->headers[len + 1] = '\n';
             s->headers[len + 2] = '\0';
@@ -588,6 +588,7 @@  static int http_open(URLContext *h, const char *uri, int flags,
         return http_listen(h, uri, flags, options);
     }
     ret = http_open_cnx(h, options);
+bail_out:
     if (ret < 0)
         av_dict_free(&s->chained_options);
     return ret;