Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
d2a618ab
Commit
d2a618ab
authored
Oct 12, 2012
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
af_pan: fix memleak of arg
Fixes CID718988 Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
f374e998
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
9 deletions
+18
-9
af_pan.c
libavfilter/af_pan.c
+18
-9
No files found.
libavfilter/af_pan.c
View file @
d2a618ab
...
@@ -115,7 +115,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args0)
...
@@ -115,7 +115,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args0)
arg
=
av_strtok
(
args
,
":"
,
&
tokenizer
);
arg
=
av_strtok
(
args
,
":"
,
&
tokenizer
);
ret
=
ff_parse_channel_layout
(
&
pan
->
out_channel_layout
,
arg
,
ctx
);
ret
=
ff_parse_channel_layout
(
&
pan
->
out_channel_layout
,
arg
,
ctx
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
ret
;
goto
fail
;
pan
->
nb_output_channels
=
av_get_channel_layout_nb_channels
(
pan
->
out_channel_layout
);
pan
->
nb_output_channels
=
av_get_channel_layout_nb_channels
(
pan
->
out_channel_layout
);
/* parse channel specifications */
/* parse channel specifications */
...
@@ -124,13 +124,15 @@ static av_cold int init(AVFilterContext *ctx, const char *args0)
...
@@ -124,13 +124,15 @@ static av_cold int init(AVFilterContext *ctx, const char *args0)
if
(
parse_channel_name
(
&
arg
,
&
out_ch_id
,
&
named
))
{
if
(
parse_channel_name
(
&
arg
,
&
out_ch_id
,
&
named
))
{
av_log
(
ctx
,
AV_LOG_ERROR
,
av_log
(
ctx
,
AV_LOG_ERROR
,
"Expected out channel name, got
\"
%.8s
\"\n
"
,
arg
);
"Expected out channel name, got
\"
%.8s
\"\n
"
,
arg
);
return
AVERROR
(
EINVAL
);
ret
=
AVERROR
(
EINVAL
);
goto
fail
;
}
}
if
(
named
)
{
if
(
named
)
{
if
(
!
((
pan
->
out_channel_layout
>>
out_ch_id
)
&
1
))
{
if
(
!
((
pan
->
out_channel_layout
>>
out_ch_id
)
&
1
))
{
av_log
(
ctx
,
AV_LOG_ERROR
,
av_log
(
ctx
,
AV_LOG_ERROR
,
"Channel
\"
%.8s
\"
does not exist in the chosen layout
\n
"
,
arg0
);
"Channel
\"
%.8s
\"
does not exist in the chosen layout
\n
"
,
arg0
);
return
AVERROR
(
EINVAL
);
ret
=
AVERROR
(
EINVAL
);
goto
fail
;
}
}
/* get the channel number in the output channel layout:
/* get the channel number in the output channel layout:
* out_channel_layout & ((1 << out_ch_id) - 1) are all the
* out_channel_layout & ((1 << out_ch_id) - 1) are all the
...
@@ -141,7 +143,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args0)
...
@@ -141,7 +143,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args0)
if
(
out_ch_id
<
0
||
out_ch_id
>=
pan
->
nb_output_channels
)
{
if
(
out_ch_id
<
0
||
out_ch_id
>=
pan
->
nb_output_channels
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
av_log
(
ctx
,
AV_LOG_ERROR
,
"Invalid out channel name
\"
%.8s
\"\n
"
,
arg0
);
"Invalid out channel name
\"
%.8s
\"\n
"
,
arg0
);
return
AVERROR
(
EINVAL
);
ret
=
AVERROR
(
EINVAL
);
goto
fail
;
}
}
skip_spaces
(
&
arg
);
skip_spaces
(
&
arg
);
if
(
*
arg
==
'='
)
{
if
(
*
arg
==
'='
)
{
...
@@ -152,7 +155,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args0)
...
@@ -152,7 +155,8 @@ static av_cold int init(AVFilterContext *ctx, const char *args0)
}
else
{
}
else
{
av_log
(
ctx
,
AV_LOG_ERROR
,
av_log
(
ctx
,
AV_LOG_ERROR
,
"Syntax error after channel name in
\"
%.8s
\"\n
"
,
arg0
);
"Syntax error after channel name in
\"
%.8s
\"\n
"
,
arg0
);
return
AVERROR
(
EINVAL
);
ret
=
AVERROR
(
EINVAL
);
goto
fail
;
}
}
/* gains */
/* gains */
while
(
1
)
{
while
(
1
)
{
...
@@ -162,13 +166,15 @@ static av_cold int init(AVFilterContext *ctx, const char *args0)
...
@@ -162,13 +166,15 @@ static av_cold int init(AVFilterContext *ctx, const char *args0)
if
(
parse_channel_name
(
&
arg
,
&
in_ch_id
,
&
named
)){
if
(
parse_channel_name
(
&
arg
,
&
in_ch_id
,
&
named
)){
av_log
(
ctx
,
AV_LOG_ERROR
,
av_log
(
ctx
,
AV_LOG_ERROR
,
"Expected in channel name, got
\"
%.8s
\"\n
"
,
arg
);
"Expected in channel name, got
\"
%.8s
\"\n
"
,
arg
);
return
AVERROR
(
EINVAL
);
ret
=
AVERROR
(
EINVAL
);
goto
fail
;
}
}
nb_in_channels
[
named
]
++
;
nb_in_channels
[
named
]
++
;
if
(
nb_in_channels
[
!
named
])
{
if
(
nb_in_channels
[
!
named
])
{
av_log
(
ctx
,
AV_LOG_ERROR
,
av_log
(
ctx
,
AV_LOG_ERROR
,
"Can not mix named and numbered channels
\n
"
);
"Can not mix named and numbered channels
\n
"
);
return
AVERROR
(
EINVAL
);
ret
=
AVERROR
(
EINVAL
);
goto
fail
;
}
}
pan
->
gain
[
out_ch_id
][
in_ch_id
]
=
gain
;
pan
->
gain
[
out_ch_id
][
in_ch_id
]
=
gain
;
skip_spaces
(
&
arg
);
skip_spaces
(
&
arg
);
...
@@ -176,15 +182,18 @@ static av_cold int init(AVFilterContext *ctx, const char *args0)
...
@@ -176,15 +182,18 @@ static av_cold int init(AVFilterContext *ctx, const char *args0)
break
;
break
;
if
(
*
arg
!=
'+'
)
{
if
(
*
arg
!=
'+'
)
{
av_log
(
ctx
,
AV_LOG_ERROR
,
"Syntax error near
\"
%.8s
\"\n
"
,
arg
);
av_log
(
ctx
,
AV_LOG_ERROR
,
"Syntax error near
\"
%.8s
\"\n
"
,
arg
);
return
AVERROR
(
EINVAL
);
ret
=
AVERROR
(
EINVAL
);
goto
fail
;
}
}
arg
++
;
arg
++
;
}
}
}
}
pan
->
need_renumber
=
!!
nb_in_channels
[
1
];
pan
->
need_renumber
=
!!
nb_in_channels
[
1
];
ret
=
0
;
fail:
av_free
(
args
);
av_free
(
args
);
return
0
;
return
ret
;
}
}
static
int
are_gains_pure
(
const
PanContext
*
pan
)
static
int
are_gains_pure
(
const
PanContext
*
pan
)
...
...
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