[vlc-devel] Rémi Duraffort : Avoid a segfault when services_discovery_GetServicesNames fail.

git version control git at videolan.org
Sun Mar 2 14:25:47 CET 2008


Module: vlc
Branch: master
Commit: 905bbb9e546101ce96a0eba8707273dafb1b8fab
URL:    http://git2.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=905bbb9e546101ce96a0eba8707273dafb1b8fab

Author: Rémi Duraffort <ivoire at via.ecp.fr>
Date:   Sun Mar  2 13:31:19 2008 +0100

Avoid a segfault when services_discovery_GetServicesNames fail.

---

 modules/gui/qt4/menus.cpp                  |    3 +++
 modules/gui/wxwidgets/dialogs/playlist.cpp |    3 +++
 modules/misc/lua/sd.c                      |    3 +++
 3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/modules/gui/qt4/menus.cpp b/modules/gui/qt4/menus.cpp
index 967b992..e76a793 100644
--- a/modules/gui/qt4/menus.cpp
+++ b/modules/gui/qt4/menus.cpp
@@ -428,6 +428,9 @@ QMenu *QVLCMenu::SDMenu( intf_thread_t *p_intf )
     char **ppsz_longnames;
     char **ppsz_names = services_discovery_GetServicesNames( p_intf,
                                                              &ppsz_longnames );
+    if( !ppsz_names )
+        return menu;
+
     char **ppsz_name = ppsz_names, **ppsz_longname = ppsz_longnames;
     for( ; *ppsz_name; ppsz_name++, ppsz_longname++ )
     {
diff --git a/modules/gui/wxwidgets/dialogs/playlist.cpp b/modules/gui/wxwidgets/dialogs/playlist.cpp
index 24ad468..d60724d 100644
--- a/modules/gui/wxwidgets/dialogs/playlist.cpp
+++ b/modules/gui/wxwidgets/dialogs/playlist.cpp
@@ -1408,6 +1408,9 @@ wxMenu *Playlist::SDMenu()
     char **ppsz_longnames;
     char **ppsz_names = services_discovery_GetServicesNames( p_playlist,
                                                              &ppsz_longnames );
+    if( !ppsz_names )
+        return p_sd_menu;
+
     char **ppsz_name = ppsz_names, **ppsz_longname = ppsz_longnames;
 
     int i_number = 0;
diff --git a/modules/misc/lua/sd.c b/modules/misc/lua/sd.c
index 8c48aa7..8a98b20 100644
--- a/modules/misc/lua/sd.c
+++ b/modules/misc/lua/sd.c
@@ -50,6 +50,9 @@ int vlclua_sd_get_services_names( lua_State *L )
     vlc_object_t *p_this = vlclua_get_this( L );
     char **ppsz_longnames;
     char **ppsz_names = services_discovery_GetServicesNames( p_this, &ppsz_longnames );
+    if( !ppsz_names )
+        return 0;
+
     char **ppsz_longname = ppsz_longnames;
     char **ppsz_name = ppsz_names;
     lua_settop( L, 0 );




More information about the vlc-devel mailing list