Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
0d8adc76
Commit
0d8adc76
authored
Aug 01, 2008
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lua/intf: Fix a memleak.
parent
5eea1626
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
modules/misc/lua/intf.c
modules/misc/lua/intf.c
+8
-4
No files found.
modules/misc/lua/intf.c
View file @
0d8adc76
...
@@ -125,7 +125,7 @@ static bool WordInList( const char *psz_list, const char *psz_word )
...
@@ -125,7 +125,7 @@ static bool WordInList( const char *psz_list, const char *psz_word )
return
false
;
return
false
;
}
}
static
c
onst
c
har
*
GetModuleName
(
intf_thread_t
*
p_intf
)
static
char
*
GetModuleName
(
intf_thread_t
*
p_intf
)
{
{
int
i
;
int
i
;
const
char
*
psz_intf
;
const
char
*
psz_intf
;
...
@@ -136,7 +136,7 @@ static const char *GetModuleName( intf_thread_t *p_intf )
...
@@ -136,7 +136,7 @@ static const char *GetModuleName( intf_thread_t *p_intf )
for
(
i
=
0
;
pp_shortcuts
[
i
].
psz_name
;
i
++
)
for
(
i
=
0
;
pp_shortcuts
[
i
].
psz_name
;
i
++
)
{
{
if
(
WordInList
(
psz_intf
,
pp_shortcuts
[
i
].
psz_shortcut
)
)
if
(
WordInList
(
psz_intf
,
pp_shortcuts
[
i
].
psz_shortcut
)
)
return
pp_shortcuts
[
i
].
psz_name
;
return
strdup
(
pp_shortcuts
[
i
].
psz_name
)
;
}
}
return
config_GetPsz
(
p_intf
,
"lua-intf"
);
return
config_GetPsz
(
p_intf
,
"lua-intf"
);
...
@@ -150,14 +150,15 @@ int Open_LuaIntf( vlc_object_t *p_this )
...
@@ -150,14 +150,15 @@ int Open_LuaIntf( vlc_object_t *p_this )
intf_sys_t
*
p_sys
;
intf_sys_t
*
p_sys
;
lua_State
*
L
;
lua_State
*
L
;
c
onst
c
har
*
psz_name
=
GetModuleName
(
p_intf
);
char
*
psz_name
=
GetModuleName
(
p_intf
);
const
char
*
psz_config
;
const
char
*
psz_config
;
bool
b_config_set
=
false
;
bool
b_config_set
=
false
;
if
(
!
psz_name
)
psz_name
=
"dummy"
;
if
(
!
psz_name
)
psz_name
=
strdup
(
"dummy"
)
;
p_intf
->
p_sys
=
(
intf_sys_t
*
)
malloc
(
sizeof
(
intf_sys_t
*
)
);
p_intf
->
p_sys
=
(
intf_sys_t
*
)
malloc
(
sizeof
(
intf_sys_t
*
)
);
if
(
!
p_intf
->
p_sys
)
if
(
!
p_intf
->
p_sys
)
{
{
free
(
psz_name
);
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
}
}
p_sys
=
p_intf
->
p_sys
;
p_sys
=
p_intf
->
p_sys
;
...
@@ -166,6 +167,7 @@ int Open_LuaIntf( vlc_object_t *p_this )
...
@@ -166,6 +167,7 @@ int Open_LuaIntf( vlc_object_t *p_this )
{
{
msg_Err
(
p_intf
,
"Couldn't find lua interface script
\"
%s
\"
."
,
msg_Err
(
p_intf
,
"Couldn't find lua interface script
\"
%s
\"
."
,
psz_name
);
psz_name
);
free
(
psz_name
);
free
(
p_sys
);
free
(
p_sys
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -175,6 +177,7 @@ int Open_LuaIntf( vlc_object_t *p_this )
...
@@ -175,6 +177,7 @@ int Open_LuaIntf( vlc_object_t *p_this )
if
(
!
L
)
if
(
!
L
)
{
{
msg_Err
(
p_intf
,
"Could not create new Lua State"
);
msg_Err
(
p_intf
,
"Could not create new Lua State"
);
free
(
psz_name
);
free
(
p_sys
);
free
(
p_sys
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -261,6 +264,7 @@ int Open_LuaIntf( vlc_object_t *p_this )
...
@@ -261,6 +264,7 @@ int Open_LuaIntf( vlc_object_t *p_this )
p_intf
->
pf_run
=
Run
;
p_intf
->
pf_run
=
Run
;
p_intf
->
psz_header
=
strdup
(
psz_name
);
/* Do I need to clean that up myself in Close_LuaIntf? */
p_intf
->
psz_header
=
strdup
(
psz_name
);
/* Do I need to clean that up myself in Close_LuaIntf? */
free
(
psz_name
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
...
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