[vlc-commits] ml: correctly handle initdatabase failure

Francois Cartegnie git at videolan.org
Fri Aug 10 13:33:18 CEST 2012


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Aug 10 13:32:53 2012 +0200| [d737d5681a1e40accd6a76d111fa78f71a5bd218] | committer: Francois Cartegnie

ml: correctly handle initdatabase failure

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

 modules/media_library/sql_media_library.c |    6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/modules/media_library/sql_media_library.c b/modules/media_library/sql_media_library.c
index 7828f86..0604f48 100644
--- a/modules/media_library/sql_media_library.c
+++ b/modules/media_library/sql_media_library.c
@@ -160,7 +160,7 @@ static int load( vlc_object_t *obj )
     if ( InitDatabase( p_ml ) != VLC_SUCCESS )
     {
         vlc_mutex_destroy( &p_ml->p_sys->lock );
-        //free( p_ml->p_sys ); // FIXME: Freed in InitDatase ?!?
+        free( p_ml->p_sys );
         return VLC_EGENERIC;
     }
 
@@ -1064,11 +1064,7 @@ int InitDatabase( media_library_t *p_ml )
     p_ml->p_sys->p_sql = sql_Create( p_ml, NULL, psz_dbhost, i_port, psz_user,
                                      psz_pass );
     if( !p_ml->p_sys->p_sql )
-    {
-        vlc_mutex_destroy( &p_ml->p_sys->lock );
-        free( p_ml->p_sys );
         return VLC_EGENERIC;
-    }
 
     /* Let's check if tables exist */
     int i_version = GetDatabaseVersion( p_ml );



More information about the vlc-commits mailing list