[vlc-commits] gnutls: fix memory leak in error case

Rémi Denis-Courmont git at videolan.org
Sat Sep 29 18:33:03 CEST 2012


vlc/vlc-2.0 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Sep 29 15:16:20 2012 +0300| [fb7e2b90b172d7aec477025a3e72ce0de90ffc47] | committer: Rémi Denis-Courmont

gnutls: fix memory leak in error case

(cherry picked from commit 38150d6e9de4d8d382149aa2e174b565958ceef7)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=fb7e2b90b172d7aec477025a3e72ce0de90ffc47
---

 modules/misc/gnutls.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/misc/gnutls.c b/modules/misc/gnutls.c
index fdfd37b..f216709 100644
--- a/modules/misc/gnutls.c
+++ b/modules/misc/gnutls.c
@@ -819,7 +819,7 @@ static int OpenServer (vlc_object_t *obj)
 
     vlc_tls_creds_sys_t *sys = malloc (sizeof (*sys));
     if (unlikely(sys == NULL))
-        return VLC_ENOMEM;
+        goto error;
 
     server->sys     = sys;
     server->add_CA  = gnutls_ServerAddCA;
@@ -883,6 +883,7 @@ static int OpenServer (vlc_object_t *obj)
 
 error:
     free (sys);
+    gnutls_Deinit (obj);
     return VLC_EGENERIC;
 }
 



More information about the vlc-commits mailing list