[vlc-commits] luasd: small reorder in initialization

Pierre Ynard git at videolan.org
Wed Nov 16 09:29:21 CET 2016


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Wed Nov 16 09:19:11 2016 +0100| [1cb2e61136a033b5c5c8b84260b9ddb5c2383f7e] | committer: Pierre Ynard

luasd: small reorder in initialization

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

 modules/lua/services_discovery.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/modules/lua/services_discovery.c b/modules/lua/services_discovery.c
index 09ba48a..66cf278 100644
--- a/modules/lua/services_discovery.c
+++ b/modules/lua/services_discovery.c
@@ -105,6 +105,9 @@ int Open_LuaSD( vlc_object_t *p_this )
     lua_State *L = NULL;
     char *psz_name;
 
+    if( !( p_sys = malloc( sizeof( services_discovery_sys_t ) ) ) )
+        return VLC_ENOMEM;
+
     if( !strcmp( p_sd->psz_name, "lua" ) )
     {
         // We want to load the module name "lua"
@@ -119,11 +122,6 @@ int Open_LuaSD( vlc_object_t *p_this )
         psz_name = strdup(p_sd->psz_name);
     }
 
-    if( !( p_sys = malloc( sizeof( services_discovery_sys_t ) ) ) )
-    {
-        free( psz_name );
-        return VLC_ENOMEM;
-    }
     p_sd->p_sys = p_sys;
     p_sd->pf_control = Control;
     p_sys->psz_filename = vlclua_find_file( "sd", psz_name );



More information about the vlc-commits mailing list