]> git.sesse.net Git - vlc/blobdiff - modules/access/cdda.c
Access/cdda: fix memleak
[vlc] / modules / access / cdda.c
index cd81e9efd03b8eeec308ce2655a6e26fd3ca75e0..e798d2191e06b5eb808a279a11b0463fedf2d401 100644 (file)
@@ -46,6 +46,7 @@
 #include <vlc_codecs.h> /* For WAVEHEADER */
 #include "vcd/cdrom.h"
 
+#warning playlist code must not be used here.
 #include <vlc_playlist.h>
 
 #ifdef HAVE_LIBCDDB
@@ -200,7 +201,7 @@ static int Open( vlc_object_t *p_this )
                 if( p_playlist->status.p_item->p_input == p_current )
                     p_item = p_playlist->status.p_item;
                 else
-                    p_item = playlist_ItemGetByInput( p_playlist, p_current, false );
+                    p_item = playlist_ItemGetByInput( p_playlist, p_current, pl_Unlocked );
 
                 if( p_item )
                     i_ret = GetTracks( p_access, p_playlist, p_item );
@@ -208,7 +209,7 @@ static int Open( vlc_object_t *p_this )
                     msg_Dbg( p_playlist, "unable to find item in playlist");
                 vlc_object_release( p_input );
             }
-            vlc_object_release( p_playlist );
+            pl_Release( p_access );
         }
         if( i_ret < 0 )
             goto error;
@@ -419,7 +420,7 @@ static int GetTracks( access_t *p_access,
         return VLC_EGENERIC;
     }
 
-    p_item_in_category = playlist_ItemToNode( p_playlist, p_parent, false );
+    p_item_in_category = playlist_ItemToNode( p_playlist, p_parent, pl_Unlocked );
     playlist_ItemSetName( p_parent, "Audio CD" );
     var_SetInteger( p_playlist, "item-change", p_parent->p_input->i_id );
 
@@ -494,7 +495,7 @@ static int GetTracks( access_t *p_access,
         int i_ret = playlist_BothAddInput( p_playlist, p_input_item,
                                p_item_in_category,
                                PLAYLIST_APPEND, PLAYLIST_END, NULL, NULL,
-                               false );
+                               pl_Unlocked );
         vlc_gc_decref( p_input_item );
         free( psz_uri ); free( psz_opt ); free( psz_name );
         free( psz_first ); free( psz_last );
@@ -517,9 +518,11 @@ static void GetCDDBInfo( access_t *p_access, int i_titles, int *p_sectors )
         goto cddb_destroy;
     }
 
+    char* psz_tmp = config_GetPsz( p_access, "cddb-server" );
     cddb_set_email_address( p_cddb, "vlc@videolan.org" );
-    cddb_set_server_name( p_cddb, config_GetPsz( p_access, "cddb-server" ) );
+    cddb_set_server_name( p_cddb, psz_tmp );
     cddb_set_server_port( p_cddb, config_GetInt( p_access, "cddb-port" ) );
+    free( psz_tmp );
 
     /// \todo
     cddb_cache_disable( p_cddb );