Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
ceff29b9
Commit
ceff29b9
authored
Jul 31, 2014
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/resample: check for malloc failure
Found-by: CSA Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
72555f4a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
resample.c
libavcodec/resample.c
+9
-1
No files found.
libavcodec/resample.c
View file @
ceff29b9
...
@@ -348,9 +348,16 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl
...
@@ -348,9 +348,16 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl
/* XXX: move those malloc to resample init code */
/* XXX: move those malloc to resample init code */
for
(
i
=
0
;
i
<
s
->
filter_channels
;
i
++
)
{
for
(
i
=
0
;
i
<
s
->
filter_channels
;
i
++
)
{
bufin
[
i
]
=
av_malloc_array
((
nb_samples
+
s
->
temp_len
),
sizeof
(
short
));
bufin
[
i
]
=
av_malloc_array
((
nb_samples
+
s
->
temp_len
),
sizeof
(
short
));
bufout
[
i
]
=
av_malloc_array
(
lenout
,
sizeof
(
short
));
if
(
!
bufin
[
i
]
||
!
bufout
[
i
])
{
av_log
(
s
->
resample_context
,
AV_LOG_ERROR
,
"Could not allocate buffer
\n
"
);
nb_samples1
=
0
;
goto
fail
;
}
memcpy
(
bufin
[
i
],
s
->
temp
[
i
],
s
->
temp_len
*
sizeof
(
short
));
memcpy
(
bufin
[
i
],
s
->
temp
[
i
],
s
->
temp_len
*
sizeof
(
short
));
buftmp2
[
i
]
=
bufin
[
i
]
+
s
->
temp_len
;
buftmp2
[
i
]
=
bufin
[
i
]
+
s
->
temp_len
;
bufout
[
i
]
=
av_malloc_array
(
lenout
,
sizeof
(
short
));
}
}
if
(
s
->
input_channels
==
2
&&
s
->
output_channels
==
1
)
{
if
(
s
->
input_channels
==
2
&&
s
->
output_channels
==
1
)
{
...
@@ -411,6 +418,7 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl
...
@@ -411,6 +418,7 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl
}
}
}
}
fail:
for
(
i
=
0
;
i
<
s
->
filter_channels
;
i
++
)
{
for
(
i
=
0
;
i
<
s
->
filter_channels
;
i
++
)
{
av_free
(
bufin
[
i
]);
av_free
(
bufin
[
i
]);
av_free
(
bufout
[
i
]);
av_free
(
bufout
[
i
]);
...
...
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