[vlc-devel] commit: RTMP: fix memory leak and use after free on error paths ( Rémi Denis-Courmont )

git version control git at videolan.org
Tue Nov 17 17:45:04 CET 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Nov 17 18:44:44 2009 +0200| [2a960712ff1ecb9074498b5930ecba930ff2d6e0] | committer: Rémi Denis-Courmont 

RTMP: fix memory leak and use after free on error paths

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

 modules/access_output/rtmp.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/access_output/rtmp.c b/modules/access_output/rtmp.c
index b49181a..3994446 100644
--- a/modules/access_output/rtmp.c
+++ b/modules/access_output/rtmp.c
@@ -96,7 +96,10 @@ static int Open( vlc_object_t *p_this )
     p_sys->p_thread =
         vlc_object_create( p_access, sizeof( rtmp_control_thread_t ) );
     if( !p_sys->p_thread )
+    {
+        free( p_sys );
         return VLC_ENOMEM;
+    }
     vlc_object_attach( p_sys->p_thread, p_access );
 
     /* Parse URI - remove spaces */
@@ -247,10 +250,9 @@ error2:
     if( p_sys->p_thread->fd != -1 )
         net_Close( p_sys->p_thread->fd );
 error:
+    vlc_UrlClean( &p_sys->p_thread->url );
     vlc_object_detach( p_sys->p_thread );
     vlc_object_release( p_sys->p_thread );
-
-    vlc_UrlClean( &p_sys->p_thread->url );
     free( p_sys );
 
     return VLC_EGENERIC;




More information about the vlc-devel mailing list