[vlc-commits] avi: memory leak

Rémi Denis-Courmont git at videolan.org
Wed Apr 23 18:15:22 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Apr 23 19:15:10 2014 +0300| [d3cd6fa1c6309039febba54ab1fb2aaf27ec9a9d] | committer: Rémi Denis-Courmont

avi: memory leak

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

 modules/demux/avi/avi.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 9c4cbeb..e62c4e9 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -465,7 +465,11 @@ static int Open( vlc_object_t * p_this )
                 if( fmt.i_extra > 0 )
                 {
                     fmt.p_extra = malloc( fmt.i_extra );
-                    if( !fmt.p_extra ) goto error;
+                    if( unlikely(fmt.p_extra == NULL) )
+                    {
+                        free( tk );
+                        goto error;
+                    }
                     memcpy( fmt.p_extra, &p_auds->p_wf[1], fmt.i_extra );
                 }
                 break;
@@ -586,7 +590,11 @@ static int Open( vlc_object_t * p_this )
                 if( fmt.i_extra > 0 )
                 {
                     fmt.p_extra = malloc( fmt.i_extra );
-                    if( !fmt.p_extra ) goto error;
+                    if( unlikely(fmt.p_extra == NULL) )
+                    {
+                        free( tk );
+                        goto error;
+                    }
                     memcpy( fmt.p_extra, &p_vids->p_bih[1], fmt.i_extra );
                 }
 



More information about the vlc-commits mailing list