]> git.sesse.net Git - vlc/blobdiff - modules/misc/audioscrobbler.c
vlc_list_children: fix memory leaks
[vlc] / modules / misc / audioscrobbler.c
index 653dd4fc2fba6786a9626b5b3210913630ab0f41..5230f20804e20dede1cc5fcf1c08c32b6e35684e 100644 (file)
@@ -39,6 +39,7 @@
 #endif
 
 #include <vlc/vlc.h>
+#include <vlc_plugin.h>
 #include <vlc_interface.h>
 #include <vlc_meta.h>
 #include <vlc_md5.h>
@@ -273,25 +274,21 @@ static void Run( intf_thread_t *p_intf )
         bool b_die = false, b_wait = false;
 
         vlc_object_lock( p_intf );
-        if( vlc_object_alive( p_intf ) )
-        {
-           if( mdate() < p_sys->next_exchange )
-                /* wait until we can resubmit, i.e.  */
-                b_wait = !vlc_object_timedwait( p_intf,
-                                                p_sys->next_exchange );
-            else
-                /* wait for data to submit */
-                /* we are signaled each time there is a song to submit */
-               vlc_object_wait( p_intf );
-        }
-        b_die = !vlc_object_alive( p_intf );
-        vlc_object_unlock( p_intf );
-
-        if( b_die )
+        if( !vlc_object_alive( p_intf ) )
         {
+            vlc_object_unlock( p_intf );
             msg_Dbg( p_intf, "audioscrobbler is dying");
             return;
         }
+        if( mdate() < p_sys->next_exchange )
+            /* wait until we can resubmit, i.e.  */
+            b_wait = vlc_object_timedwait( p_intf, p_sys->next_exchange ) == 0;
+        else
+            /* wait for data to submit */
+            /* we are signaled each time there is a song to submit */
+            vlc_object_wait( p_intf );
+        vlc_object_unlock( p_intf );
+
         if( b_wait )
             continue; /* holding on until next_exchange */