[vlc-commits] real: fix potential memory leak.

Rémi Duraffort git at videolan.org
Sun Apr 8 09:23:46 CEST 2012


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sat Apr  7 18:07:46 2012 +0200| [d2a4fbf984cb832e54aea0cc5e2f6d5d6732a0bd] | committer: Rémi Duraffort

real: fix potential memory leak.

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

 modules/demux/real.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/modules/demux/real.c b/modules/demux/real.c
index df1a0ad..06f9f3a 100644
--- a/modules/demux/real.c
+++ b/modules/demux/real.c
@@ -1567,7 +1567,10 @@ static int CodecAudioParse( demux_t *p_demux, int i_tk_id, const uint8_t *p_data
         {
             fmt.p_extra = malloc( i_extra_codec );
             if( !fmt.p_extra || i_extra_codec > i_data )
+            {
+                free( fmt.p_extra );
                 return VLC_ENOMEM;
+            }
 
             fmt.i_extra = i_extra_codec;
             memcpy( fmt.p_extra, p_data, fmt.i_extra );
@@ -1606,7 +1609,10 @@ static int CodecAudioParse( demux_t *p_demux, int i_tk_id, const uint8_t *p_data
         {
             fmt.p_extra = malloc( i_extra_codec );
             if( !fmt.p_extra || i_extra_codec > i_data )
+            {
+                free( fmt.p_extra );
                 return VLC_ENOMEM;
+            }
 
             fmt.i_extra = i_extra_codec;
             memcpy( fmt.p_extra, p_data, fmt.i_extra );



More information about the vlc-commits mailing list