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
c6a829ae
Commit
c6a829ae
authored
Mar 23, 2009
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed potential memleak in input control fifo.
Thanks Sbastien Escudier for noticing it.
parent
bd3dbe03
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
8 deletions
+29
-8
src/input/input.c
src/input/input.c
+29
-8
No files found.
src/input/input.c
View file @
c6a829ae
...
@@ -75,6 +75,7 @@ static void ObjectKillChildrens( input_thread_t *, vlc_object_t * );
...
@@ -75,6 +75,7 @@ static void ObjectKillChildrens( input_thread_t *, vlc_object_t * );
static
inline
int
ControlPop
(
input_thread_t
*
,
int
*
,
vlc_value_t
*
,
mtime_t
i_deadline
);
static
inline
int
ControlPop
(
input_thread_t
*
,
int
*
,
vlc_value_t
*
,
mtime_t
i_deadline
);
static
void
ControlReduce
(
input_thread_t
*
);
static
void
ControlReduce
(
input_thread_t
*
);
static
void
ControlRelease
(
int
i_type
,
vlc_value_t
val
);
static
bool
Control
(
input_thread_t
*
,
int
,
vlc_value_t
);
static
bool
Control
(
input_thread_t
*
,
int
,
vlc_value_t
);
static
int
UpdateTitleSeekpointFromAccess
(
input_thread_t
*
);
static
int
UpdateTitleSeekpointFromAccess
(
input_thread_t
*
);
...
@@ -318,6 +319,10 @@ static void Destructor( input_thread_t * p_input )
...
@@ -318,6 +319,10 @@ static void Destructor( input_thread_t * p_input )
vlc_mutex_destroy
(
&
p_input
->
p
->
counters
.
counters_lock
);
vlc_mutex_destroy
(
&
p_input
->
p
->
counters
.
counters_lock
);
for
(
int
i
=
0
;
i
<
p_input
->
p
->
i_control
;
i
++
)
ControlRelease
(
p_input
->
p
->
control
[
i
].
i_type
,
p_input
->
p
->
control
[
i
].
val
);
vlc_cond_destroy
(
&
p_input
->
p
->
wait_control
);
vlc_cond_destroy
(
&
p_input
->
p
->
wait_control
);
vlc_mutex_destroy
(
&
p_input
->
p
->
lock_control
);
vlc_mutex_destroy
(
&
p_input
->
p
->
lock_control
);
free
(
p_input
->
p
);
free
(
p_input
->
p
);
...
@@ -1365,6 +1370,9 @@ void input_ControlPush( input_thread_t *p_input,
...
@@ -1365,6 +1370,9 @@ void input_ControlPush( input_thread_t *p_input,
vlc_mutex_lock
(
&
p_input
->
p
->
lock_control
);
vlc_mutex_lock
(
&
p_input
->
p
->
lock_control
);
if
(
i_type
==
INPUT_CONTROL_SET_DIE
)
if
(
i_type
==
INPUT_CONTROL_SET_DIE
)
{
{
for
(
int
i
=
0
;
i
<
p_input
->
p
->
i_control
;
i
++
)
ControlRelease
(
p_input
->
p
->
control
[
i
].
i_type
,
p_input
->
p
->
control
[
i
].
val
);
/* Special case, empty the control */
/* Special case, empty the control */
p_input
->
p
->
i_control
=
1
;
p_input
->
p
->
i_control
=
1
;
p_input
->
p
->
control
[
0
].
i_type
=
i_type
;
p_input
->
p
->
control
[
0
].
i_type
=
i_type
;
...
@@ -1374,6 +1382,8 @@ void input_ControlPush( input_thread_t *p_input,
...
@@ -1374,6 +1382,8 @@ void input_ControlPush( input_thread_t *p_input,
{
{
msg_Err
(
p_input
,
"input control fifo overflow, trashing type=%d"
,
msg_Err
(
p_input
,
"input control fifo overflow, trashing type=%d"
,
i_type
);
i_type
);
if
(
p_val
)
ControlRelease
(
i_type
,
*
p_val
);
}
}
else
else
{
{
...
@@ -1468,6 +1478,21 @@ static void ControlReduce( input_thread_t *p_input )
...
@@ -1468,6 +1478,21 @@ static void ControlReduce( input_thread_t *p_input )
}
}
vlc_mutex_unlock
(
&
p_input
->
p
->
lock_control
);
vlc_mutex_unlock
(
&
p_input
->
p
->
lock_control
);
}
}
static
void
ControlRelease
(
int
i_type
,
vlc_value_t
val
)
{
switch
(
i_type
)
{
case
INPUT_CONTROL_ADD_SUBTITLE
:
case
INPUT_CONTROL_ADD_SLAVE
:
free
(
val
.
psz_string
);
break
;
default:
break
;
}
}
/* Pause input */
/* Pause input */
static
void
ControlPause
(
input_thread_t
*
p_input
,
mtime_t
i_control_date
)
static
void
ControlPause
(
input_thread_t
*
p_input
,
mtime_t
i_control_date
)
{
{
...
@@ -1534,8 +1559,8 @@ static void ControlUnpause( input_thread_t *p_input, mtime_t i_control_date )
...
@@ -1534,8 +1559,8 @@ static void ControlUnpause( input_thread_t *p_input, mtime_t i_control_date )
es_out_SetPauseState
(
p_input
->
p
->
p_es_out
,
false
,
false
,
i_control_date
);
es_out_SetPauseState
(
p_input
->
p
->
p_es_out
,
false
,
false
,
i_control_date
);
}
}
static
bool
Control
(
input_thread_t
*
p_input
,
int
i_type
,
static
bool
Control
(
input_thread_t
*
p_input
,
vlc_value_t
val
)
int
i_type
,
vlc_value_t
val
)
{
{
const
mtime_t
i_control_date
=
mdate
();
const
mtime_t
i_control_date
=
mdate
();
/* FIXME b_force_update is abused, it should be carefully checked */
/* FIXME b_force_update is abused, it should be carefully checked */
...
@@ -1977,10 +2002,7 @@ static bool Control( input_thread_t *p_input, int i_type,
...
@@ -1977,10 +2002,7 @@ static bool Control( input_thread_t *p_input, int i_type,
case
INPUT_CONTROL_ADD_SUBTITLE
:
case
INPUT_CONTROL_ADD_SUBTITLE
:
if
(
val
.
psz_string
)
if
(
val
.
psz_string
)
{
SubtitleAdd
(
p_input
,
val
.
psz_string
,
true
);
SubtitleAdd
(
p_input
,
val
.
psz_string
,
true
);
free
(
val
.
psz_string
);
}
break
;
break
;
case
INPUT_CONTROL_ADD_SLAVE
:
case
INPUT_CONTROL_ADD_SLAVE
:
...
@@ -2032,8 +2054,6 @@ static bool Control( input_thread_t *p_input, int i_type,
...
@@ -2032,8 +2054,6 @@ static bool Control( input_thread_t *p_input, int i_type,
msg_Warn
(
p_input
,
"failed to add %s as slave"
,
msg_Warn
(
p_input
,
"failed to add %s as slave"
,
val
.
psz_string
);
val
.
psz_string
);
}
}
free
(
val
.
psz_string
);
}
}
break
;
break
;
...
@@ -2120,6 +2140,7 @@ static bool Control( input_thread_t *p_input, int i_type,
...
@@ -2120,6 +2140,7 @@ static bool Control( input_thread_t *p_input, int i_type,
break
;
break
;
}
}
ControlRelease
(
i_type
,
val
);
return
b_force_update
;
return
b_force_update
;
}
}
...
...
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