]> git.sesse.net Git - vlc/commitdiff
Fix unlikely deadlock
authorRémi Denis-Courmont <rem@videolan.org>
Thu, 4 Jan 2007 15:02:14 +0000 (15:02 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Thu, 4 Jan 2007 15:02:14 +0000 (15:02 +0000)
modules/access/directory.c

index 3c6d47955ac10b166f18435c07a38dc6d8f0fbf4..4334a1baba82018473b79ebcbb9ca14b43635ae6 100644 (file)
@@ -182,6 +182,11 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len)
 {
     char               *psz;
     int                 i_mode, i_activity;
+    char               *psz_name = strdup (p_access->psz_path);
+
+    if( psz_name == NULL )
+        return VLC_ENOMEM;
+
     playlist_t         *p_playlist = pl_Yield( p_access );
     playlist_item_t    *p_item_in_category;
     input_item_t       *p_current_input = input_GetItem(
@@ -189,13 +194,11 @@ static int Read( access_t *p_access, uint8_t *p_buffer, int i_len)
     playlist_item_t    *p_current = playlist_ItemGetByInput( p_playlist,
                                                              p_current_input,
                                                              VLC_FALSE );
-    char               *psz_name = strdup (p_access->psz_path);
 
-    if( psz_name == NULL )
-        return VLC_ENOMEM;
-
-    if( p_current == NULL ) {
+    if( p_current == NULL )
+    {
         msg_Err( p_access, "unable to find item in playlist" );
+        vlc_object_release( p_playlist );
         return VLC_ENOOBJ;
     }