[vlc-devel] commit: Fix potential memleak. ( Rémi Duraffort )

git version control git at videolan.org
Wed Aug 20 23:19:34 CEST 2008


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Wed Aug 20 22:13:13 2008 +0200| [fc1e5cd76b2735cb684615e1cff2a1bb0e7c6d29] | committer: Rémi Duraffort 

Fix potential memleak.

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

 modules/audio_filter/resampler/linear.c          |    3 +++
 modules/audio_filter/spatializer/spatializer.cpp |    2 ++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/modules/audio_filter/resampler/linear.c b/modules/audio_filter/resampler/linear.c
index ea339b5..59c6e95 100644
--- a/modules/audio_filter/resampler/linear.c
+++ b/modules/audio_filter/resampler/linear.c
@@ -103,7 +103,10 @@ static int Create( vlc_object_t *p_this )
     p_sys->p_prev_sample = malloc(
         p_filter->input.i_channels * sizeof(int32_t) );
     if( p_sys->p_prev_sample == NULL )
+    {
+        free( p_sys );
         return VLC_ENOMEM;
+    }
     aout_DateInit( &p_sys->end_date, p_filter->output.i_rate );
 
     p_filter->pf_do_work = DoWork;
diff --git a/modules/audio_filter/spatializer/spatializer.cpp b/modules/audio_filter/spatializer/spatializer.cpp
index e017d7f..b4edc12 100644
--- a/modules/audio_filter/spatializer/spatializer.cpp
+++ b/modules/audio_filter/spatializer/spatializer.cpp
@@ -142,6 +142,8 @@ static int Open( vlc_object_t *p_this )
 
      /* Allocate structure */
     p_sys = p_filter->p_sys = (aout_filter_sys_t*)malloc( sizeof( aout_filter_sys_t ) );
+    if( !p_sys )
+        return VLC_ENOMEM;
 
     vlc_mutex_init( &p_sys->lock );
     p_sys->p_reverbm = new revmodel();




More information about the vlc-devel mailing list