]> git.sesse.net Git - vlc/blobdiff - modules/services_discovery/bonjour.c
lua/intf: Fix a memleak.
[vlc] / modules / services_discovery / bonjour.c
index 2c896117a1ba1e8ddcab456c63a2a07312634fd2..f30c0e2f2543e6408a49c4c7cc7ef7d839791121 100644 (file)
@@ -29,7 +29,8 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_playlist.h>
 #include <vlc_arrays.h>
 
@@ -52,7 +53,7 @@
 
 vlc_module_begin();
     set_shortname( "Bonjour" );
-    set_description( _("Bonjour services") );
+    set_description( N_("Bonjour services") );
     set_category( CAT_PLAYLIST );
     set_subcategory( SUBCAT_PLAYLIST_SD );
     set_capability( "services_discovery", 0 );
@@ -121,6 +122,11 @@ static void resolve_callback(
 {
     services_discovery_t *p_sd = ( services_discovery_t* )userdata;
     services_discovery_sys_t *p_sys = p_sd->p_sys;
+    
+    VLC_UNUSED(interface); VLC_UNUSED(host_name);
+#ifdef HAVE_AVAHI_06
+    VLC_UNUSED(flags);
+#endif
 
 #ifdef HAVE_AVAHI_06
     if( event == AVAHI_RESOLVER_FAILURE )
@@ -216,6 +222,10 @@ static void browse_callback(
 #endif
     void* userdata )
 {
+    VLC_UNUSED(b);
+#ifdef HAVE_AVAHI_06
+    VLC_UNUSED(flags);
+#endif
     services_discovery_t *p_sd = ( services_discovery_t* )userdata;
     services_discovery_sys_t *p_sys = p_sd->p_sys;
     if( event == AVAHI_BROWSER_NEW )
@@ -261,11 +271,9 @@ static int Open( vlc_object_t *p_this )
 
     p_sd->p_sys = p_sys = (services_discovery_sys_t *)malloc(
         sizeof( services_discovery_sys_t ) );
-    if( p_sd->p_sys == NULL )
-    {
-        msg_Err( p_sd, "out of memory" );
-        return VLC_EGENERIC;
-    }
+
+    if( !p_sys )
+        return VLC_ENOMEM;
 
     memset( p_sys, 0, sizeof(*p_sys) );
 
@@ -346,7 +354,7 @@ static void Run( services_discovery_t *p_sd )
 {
     services_discovery_sys_t *p_sys = p_sd->p_sys;
 
-    while( !p_sd->b_die )
+    while( vlc_object_alive (p_sd) )
     {
         if( avahi_simple_poll_iterate( p_sys->simple_poll, 100 ) != 0 )
         {