diff mbox series

[FFmpeg-devel,v1] lavf/tls_mbedtls: fix resource leak

Message ID 1587365892-2346-1-git-send-email-mypopydev@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel,v1] lavf/tls_mbedtls: fix resource leak | expand

Checks

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

Commit Message

Jun Zhao April 20, 2020, 6:58 a.m. UTC
From: Jun Zhao <barryjzhao@tencent.com>

fix resource leak in mbedtls part.

fix #8614

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
---
 libavformat/tls_mbedtls.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Andreas Rheinhardt April 20, 2020, 7:05 a.m. UTC | #1
Jun Zhao:
> From: Jun Zhao <barryjzhao@tencent.com>
> 
> fix resource leak in mbedtls part.
> 
> fix #8614
> 
> Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> ---
>  libavformat/tls_mbedtls.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavformat/tls_mbedtls.c b/libavformat/tls_mbedtls.c
> index 9b80a1e..eb4b2a0 100644
> --- a/libavformat/tls_mbedtls.c
> +++ b/libavformat/tls_mbedtls.c
> @@ -62,6 +62,8 @@ static int tls_close(URLContext *h)
>      mbedtls_ctr_drbg_free(&tls_ctx->ctr_drbg_context);
>      mbedtls_entropy_free(&tls_ctx->entropy_context);
>  
> +    if (tls_ctx->tls_shared.tcp)
> +        ffurl_close(tls_ctx->tls_shared.tcp);
>      return 0;
>  }
>  
> You can simply use ffurl_closep() instead of these two lines.

- Andreas
mypopy@gmail.com April 20, 2020, 7:46 a.m. UTC | #2
On Mon, Apr 20, 2020 at 3:05 PM Andreas Rheinhardt
<andreas.rheinhardt@gmail.com> wrote:
>
> Jun Zhao:
> > From: Jun Zhao <barryjzhao@tencent.com>
> >
> > fix resource leak in mbedtls part.
> >
> > fix #8614
> >
> > Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
> > ---
> >  libavformat/tls_mbedtls.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/libavformat/tls_mbedtls.c b/libavformat/tls_mbedtls.c
> > index 9b80a1e..eb4b2a0 100644
> > --- a/libavformat/tls_mbedtls.c
> > +++ b/libavformat/tls_mbedtls.c
> > @@ -62,6 +62,8 @@ static int tls_close(URLContext *h)
> >      mbedtls_ctr_drbg_free(&tls_ctx->ctr_drbg_context);
> >      mbedtls_entropy_free(&tls_ctx->entropy_context);
> >
> > +    if (tls_ctx->tls_shared.tcp)
> > +        ffurl_close(tls_ctx->tls_shared.tcp);
> >      return 0;
> >  }
> >
> > You can simply use ffurl_closep() instead of these two lines.
>
Yes, will update the code,tks
diff mbox series

Patch

diff --git a/libavformat/tls_mbedtls.c b/libavformat/tls_mbedtls.c
index 9b80a1e..eb4b2a0 100644
--- a/libavformat/tls_mbedtls.c
+++ b/libavformat/tls_mbedtls.c
@@ -62,6 +62,8 @@  static int tls_close(URLContext *h)
     mbedtls_ctr_drbg_free(&tls_ctx->ctr_drbg_context);
     mbedtls_entropy_free(&tls_ctx->entropy_context);
 
+    if (tls_ctx->tls_shared.tcp)
+        ffurl_close(tls_ctx->tls_shared.tcp);
     return 0;
 }