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
a9782f63
Commit
a9782f63
authored
Feb 04, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LUA SD: simplify and fix a memory leak (untested)
parent
4550f048
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
41 deletions
+27
-41
modules/misc/lua/vlc.c
modules/misc/lua/vlc.c
+27
-41
No files found.
modules/misc/lua/vlc.c
View file @
a9782f63
...
@@ -196,69 +196,55 @@ int vlclua_scripts_batch_execute( vlc_object_t *p_this,
...
@@ -196,69 +196,55 @@ int vlclua_scripts_batch_execute( vlc_object_t *p_this,
lua_State
*
L
,
lua_State
*
L
,
void
*
user_data
)
void
*
user_data
)
{
{
int
i_ret
=
VLC_EGENERIC
;
char
**
ppsz_filelist
=
NULL
;
char
**
ppsz_fileend
=
NULL
;
char
**
ppsz_file
;
char
*
ppsz_dir_list
[]
=
{
NULL
,
NULL
,
NULL
,
NULL
};
char
*
ppsz_dir_list
[]
=
{
NULL
,
NULL
,
NULL
,
NULL
};
char
**
ppsz_dir
;
i_ret
=
vlclua_dir_list
(
p_this
,
luadirname
,
ppsz_dir_list
);
i
nt
i
_ret
=
vlclua_dir_list
(
p_this
,
luadirname
,
ppsz_dir_list
);
if
(
i_ret
!=
VLC_SUCCESS
)
if
(
i_ret
!=
VLC_SUCCESS
)
return
i_ret
;
return
i_ret
;
i_ret
=
VLC_EGENERIC
;
i_ret
=
VLC_EGENERIC
;
for
(
char
**
ppsz_dir
=
ppsz_dir_list
;
*
ppsz_dir
;
ppsz_dir
++
)
for
(
ppsz_dir
=
ppsz_dir_list
;
*
ppsz_dir
;
ppsz_dir
++
)
{
{
char
**
ppsz_filelist
;
int
i_files
;
int
i_files
;
if
(
ppsz_filelist
)
{
for
(
ppsz_file
=
ppsz_filelist
;
ppsz_file
<
ppsz_fileend
;
ppsz_file
++
)
free
(
*
ppsz_file
);
free
(
ppsz_filelist
);
ppsz_filelist
=
NULL
;
}
msg_Dbg
(
p_this
,
"Trying Lua scripts in %s"
,
*
ppsz_dir
);
msg_Dbg
(
p_this
,
"Trying Lua scripts in %s"
,
*
ppsz_dir
);
i_files
=
utf8_scandir
(
*
ppsz_dir
,
&
ppsz_filelist
,
file_select
,
i_files
=
utf8_scandir
(
*
ppsz_dir
,
&
ppsz_filelist
,
file_select
,
file_compare
);
file_compare
);
if
(
i_files
<
1
)
continue
;
if
(
i_files
<
0
)
ppsz_fileend
=
ppsz_filelist
+
i_files
;
continue
;
for
(
ppsz_file
=
ppsz_filelist
;
ppsz_file
<
ppsz_fileend
;
ppsz_file
++
)
char
**
ppsz_file
=
ppsz_filelist
;
char
**
ppsz_fileend
=
ppsz_filelist
+
i_files
;
while
(
ppsz_file
<
ppsz_fileend
)
{
{
char
*
psz_filename
;
char
*
psz_filename
;
if
(
asprintf
(
&
psz_filename
,
if
(
asprintf
(
&
psz_filename
,
"%s"
DIR_SEP
"%s"
,
*
ppsz_dir
,
*
ppsz_file
)
<
0
)
"%s"
DIR_SEP
"%s"
,
*
ppsz_dir
,
*
ppsz_file
)
==
-
1
)
{
psz_filename
=
NULL
;
vlclua_dir_list_free
(
ppsz_dir_list
);
free
(
*
(
ppsz_file
++
)
);
return
VLC_ENOMEM
;
}
msg_Dbg
(
p_this
,
"Trying Lua playlist script %s"
,
psz_filename
);
if
(
likely
(
psz_filename
!=
NULL
)
)
{
msg_Dbg
(
p_this
,
"Trying Lua playlist script %s"
,
psz_filename
);
i_ret
=
func
(
p_this
,
psz_filename
,
L
,
user_data
);
i_ret
=
func
(
p_this
,
psz_filename
,
L
,
user_data
);
free
(
psz_filename
);
free
(
psz_filename
);
if
(
i_ret
==
VLC_SUCCESS
)
if
(
i_ret
==
VLC_SUCCESS
)
break
;
break
;
}
}
if
(
i_ret
==
VLC_SUCCESS
)
break
;
}
}
if
(
ppsz_filelist
)
while
(
ppsz_file
<
ppsz_fileend
)
{
free
(
*
(
ppsz_file
++
)
);
for
(
ppsz_file
=
ppsz_filelist
;
ppsz_file
<
ppsz_fileend
;
ppsz_file
++
)
free
(
*
ppsz_file
);
free
(
ppsz_filelist
);
free
(
ppsz_filelist
);
if
(
i_ret
==
VLC_SUCCESS
)
break
;
}
}
vlclua_dir_list_free
(
ppsz_dir_list
);
vlclua_dir_list_free
(
ppsz_dir_list
);
return
i_ret
;
return
i_ret
;
}
}
...
...
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