[vlc-commits] upnp: Fix potential NULL dereference

Hugo Beauzée-Luyssen git at videolan.org
Wed Jan 18 16:01:30 CET 2017


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed Jan 18 14:25:33 2017 +0100| [6c968674c2239a64554fb03fbddd7385de33204d] | committer: Hugo Beauzée-Luyssen

upnp: Fix potential NULL dereference

Fix CID #1398413

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6c968674c2239a64554fb03fbddd7385de33204d
---

 modules/services_discovery/upnp.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index 8f6674d..68f5db6 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -309,6 +309,8 @@ bool MediaServerList::addServer( MediaServerDesc* desc )
         p_input_item = input_item_NewDirectory( desc->location.c_str(),
                                                 desc->friendlyName.c_str(),
                                                 ITEM_NET );
+        if ( !p_input_item )
+            return false;
 
         input_item_SetSetting( p_input_item, SATIP_SERVER_DEVICE_TYPE );
 
@@ -329,12 +331,13 @@ bool MediaServerList::addServer( MediaServerDesc* desc )
         p_input_item = input_item_NewDirectory( psz_mrl,
                                                 desc->friendlyName.c_str(),
                                                 ITEM_NET );
+        free( psz_mrl );
+
+        if ( !p_input_item )
+            return false;
 
         input_item_SetSetting( p_input_item, MEDIA_SERVER_DEVICE_TYPE );
-        free( psz_mrl );
     }
-    if ( !p_input_item )
-        return false;
 
     if ( desc->iconUrl.empty() == false )
         input_item_SetArtworkURL( p_input_item, desc->iconUrl.c_str() );



More information about the vlc-commits mailing list