[vlc-commits] commit: ML: fix potential memleaks. (=?UTF-8?Q?R=C3=A9mi=20Duraffort=20?=)

git at videolan.org git at videolan.org
Mon Dec 13 21:54:04 CET 2010


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Mon Dec 13 15:04:03 2010 +0100| [f65691230b41b3ccc1ec7792225404fc066e0fc1] | committer: Rémi Duraffort 

ML: fix potential memleaks.

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

 modules/media_library/sql_media_library.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/media_library/sql_media_library.c b/modules/media_library/sql_media_library.c
index 5af66a1..1b35260 100644
--- a/modules/media_library/sql_media_library.c
+++ b/modules/media_library/sql_media_library.c
@@ -471,7 +471,10 @@ int SQLToMediaArray( media_library_t *p_ml, vlc_array_t *p_result_array,
     /* Analyze first row */
     int *indexes = ( int* ) calloc( i_cols + 1, sizeof( int ) );
     if( !indexes )
+    {
+        vlc_array_destroy( p_intermediate_array );
         return VLC_ENOMEM;
+    }
 
     const int count = sizeof( ml_table_map )/ sizeof( struct ml_table_elt );
     for( int col = 0; col < i_cols; col++ )
@@ -508,14 +511,16 @@ int SQLToMediaArray( media_library_t *p_ml, vlc_array_t *p_result_array,
         if( !p_media )
         {
             free( indexes );
-            return VLC_ENOMEM;
+            i_ret = VLC_ENOMEM;
+            goto quit_sqlmediaarray;
         }
         p_result = ( ml_result_t * ) calloc( 1, sizeof( ml_result_t ) );
         if( !p_result )
         {
             ml_gc_decref( p_media );
             free( indexes );
-            return VLC_ENOMEM;
+            i_ret = VLC_ENOMEM;
+            goto quit_sqlmediaarray;
         }
 
         char* psz_append_pname = NULL;



More information about the vlc-commits mailing list