crypto: Use av_freep instead of av_free

Message ID 1307565531-89179-1-git-send-email-martin@martin.st
State Committed
Commit a71bcd1a7f66e210971c44452dc4cdae7bdbd98a
Headers show

Commit Message

Martin Storsjö June 8, 2011, 8:38 p.m.
From: Etienne Buira <etienne.buira.lists@free.fr>

This fixes a potential double free.
---
 libavformat/crypto.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Comments

Ronald Bultje June 8, 2011, 8:40 p.m. | #1
Hi,

On Wed, Jun 8, 2011 at 4:38 PM, Martin Storsjö <martin@martin.st> wrote:
> From: Etienne Buira <etienne.buira.lists@free.fr>
>
> This fixes a potential double free.
> ---
>  libavformat/crypto.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/crypto.c b/libavformat/crypto.c
> index 789a4d1..5e7ee1e 100644
> --- a/libavformat/crypto.c
> +++ b/libavformat/crypto.c
> @@ -97,8 +97,8 @@ static int crypto_open(URLContext *h, const char *uri, int flags)
>
>     return 0;
>  err:
> -    av_free(c->key);
> -    av_free(c->iv);
> +    av_freep(&c->key);
> +    av_freep(&c->iv);

LGTM.

Ronald

Patch

diff --git a/libavformat/crypto.c b/libavformat/crypto.c
index 789a4d1..5e7ee1e 100644
--- a/libavformat/crypto.c
+++ b/libavformat/crypto.c
@@ -97,8 +97,8 @@  static int crypto_open(URLContext *h, const char *uri, int flags)
 
     return 0;
 err:
-    av_free(c->key);
-    av_free(c->iv);
+    av_freep(&c->key);
+    av_freep(&c->iv);
     return ret;
 }