Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
6264ce13
Commit
6264ce13
authored
Feb 16, 2010
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lua_sd: fix memleak and factorize.
parent
a97937b7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
modules/misc/lua/services_discovery.c
modules/misc/lua/services_discovery.c
+6
-4
No files found.
modules/misc/lua/services_discovery.c
View file @
6264ce13
...
...
@@ -56,7 +56,7 @@ int Open_LuaSD( vlc_object_t *p_this )
{
services_discovery_t
*
p_sd
=
(
services_discovery_t
*
)
p_this
;
services_discovery_sys_t
*
p_sys
;
lua_State
*
L
;
lua_State
*
L
=
NULL
;
char
*
psz_name
=
strdup
(
p_sd
->
psz_name
);
if
(
!
strcmp
(
p_sd
->
psz_name
,
"lua"
))
...
...
@@ -74,7 +74,10 @@ int Open_LuaSD( vlc_object_t *p_this )
}
if
(
!
(
p_sys
=
malloc
(
sizeof
(
services_discovery_sys_t
)
)
)
)
{
free
(
psz_name
);
return
VLC_ENOMEM
;
}
p_sd
->
p_sys
=
p_sys
;
p_sys
->
psz_filename
=
vlclua_find_file
(
p_this
,
"sd"
,
psz_name
);
if
(
!
p_sys
->
psz_filename
)
...
...
@@ -112,7 +115,6 @@ int Open_LuaSD( vlc_object_t *p_this )
{
msg_Warn
(
p_sd
,
"Error while setting the module search path for %s"
,
p_sys
->
psz_filename
);
lua_close
(
L
);
goto
error
;
}
if
(
luaL_dofile
(
L
,
p_sys
->
psz_filename
)
)
...
...
@@ -121,17 +123,17 @@ int Open_LuaSD( vlc_object_t *p_this )
msg_Err
(
p_sd
,
"Error loading script %s: %s"
,
p_sys
->
psz_filename
,
lua_tostring
(
L
,
lua_gettop
(
L
)
)
);
lua_pop
(
L
,
1
);
lua_close
(
L
);
goto
error
;
}
p_sys
->
L
=
L
;
if
(
vlc_clone
(
&
p_sd
->
p_sys
->
thread
,
Run
,
p_sd
,
VLC_THREAD_PRIORITY_LOW
)
)
{
lua_close
(
L
);
goto
error
;
}
return
VLC_SUCCESS
;
error:
if
(
L
)
lua_close
(
L
);
free
(
p_sys
->
psz_filename
);
free
(
p_sys
);
return
VLC_EGENERIC
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment