[1/7] avio: Free URLContext private data allocated via AVOptions

Message ID 1320794165-24248-1-git-send-email-martin@martin.st
State Committed
Commit d10361b65856982fe17032590f490d494f1a01e4
Headers show

Commit Message

Martin Storsjö Nov. 8, 2011, 11:15 p.m.
---
 libavformat/avio.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

Comments

Anton Khirnov Nov. 10, 2011, 8:37 a.m. | #1
On Wed,  9 Nov 2011 01:15:59 +0200, Martin Storsjö <martin@martin.st> wrote:
> ---
>  libavformat/avio.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/libavformat/avio.c b/libavformat/avio.c
> index a954aa8..8e18549 100644
> --- a/libavformat/avio.c
> +++ b/libavformat/avio.c
> @@ -335,8 +335,11 @@ int ffurl_close(URLContext *h)
>  #if CONFIG_NETWORK
>      ff_network_close();
>  #endif
> -    if (h->prot->priv_data_size)
> +    if (h->prot->priv_data_size) {
> +        if (h->prot->priv_data_class)
> +            av_opt_free(h->priv_data);
>          av_free(h->priv_data);
> +    }
>      av_free(h);
>      return ret;
>  }
> -- 
> 1.7.3.1

Ok.

Patch

diff --git a/libavformat/avio.c b/libavformat/avio.c
index a954aa8..8e18549 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -335,8 +335,11 @@  int ffurl_close(URLContext *h)
 #if CONFIG_NETWORK
     ff_network_close();
 #endif
-    if (h->prot->priv_data_size)
+    if (h->prot->priv_data_size) {
+        if (h->prot->priv_data_class)
+            av_opt_free(h->priv_data);
         av_free(h->priv_data);
+    }
     av_free(h);
     return ret;
 }