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
52acd22a
Commit
52acd22a
authored
Jun 04, 2015
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libswresample/rematrix: Check for malloc errors
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
e91debf8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
rematrix.c
libswresample/rematrix.c
+8
-0
No files found.
libswresample/rematrix.c
View file @
52acd22a
...
...
@@ -364,6 +364,8 @@ av_cold int swri_rematrix_init(SwrContext *s){
if
(
s
->
midbuf
.
fmt
==
AV_SAMPLE_FMT_S16P
){
s
->
native_matrix
=
av_calloc
(
nb_in
*
nb_out
,
sizeof
(
int
));
s
->
native_one
=
av_mallocz
(
sizeof
(
int
));
if
(
!
s
->
native_matrix
||
!
s
->
native_one
)
return
AVERROR
(
ENOMEM
);
for
(
i
=
0
;
i
<
nb_out
;
i
++
)
for
(
j
=
0
;
j
<
nb_in
;
j
++
)
((
int
*
)
s
->
native_matrix
)[
i
*
nb_in
+
j
]
=
lrintf
(
s
->
matrix
[
i
][
j
]
*
32768
);
...
...
@@ -374,6 +376,8 @@ av_cold int swri_rematrix_init(SwrContext *s){
}
else
if
(
s
->
midbuf
.
fmt
==
AV_SAMPLE_FMT_FLTP
){
s
->
native_matrix
=
av_calloc
(
nb_in
*
nb_out
,
sizeof
(
float
));
s
->
native_one
=
av_mallocz
(
sizeof
(
float
));
if
(
!
s
->
native_matrix
||
!
s
->
native_one
)
return
AVERROR
(
ENOMEM
);
for
(
i
=
0
;
i
<
nb_out
;
i
++
)
for
(
j
=
0
;
j
<
nb_in
;
j
++
)
((
float
*
)
s
->
native_matrix
)[
i
*
nb_in
+
j
]
=
s
->
matrix
[
i
][
j
];
...
...
@@ -384,6 +388,8 @@ av_cold int swri_rematrix_init(SwrContext *s){
}
else
if
(
s
->
midbuf
.
fmt
==
AV_SAMPLE_FMT_DBLP
){
s
->
native_matrix
=
av_calloc
(
nb_in
*
nb_out
,
sizeof
(
double
));
s
->
native_one
=
av_mallocz
(
sizeof
(
double
));
if
(
!
s
->
native_matrix
||
!
s
->
native_one
)
return
AVERROR
(
ENOMEM
);
for
(
i
=
0
;
i
<
nb_out
;
i
++
)
for
(
j
=
0
;
j
<
nb_in
;
j
++
)
((
double
*
)
s
->
native_matrix
)[
i
*
nb_in
+
j
]
=
s
->
matrix
[
i
][
j
];
...
...
@@ -395,6 +401,8 @@ av_cold int swri_rematrix_init(SwrContext *s){
// Only for dithering currently
// s->native_matrix = av_calloc(nb_in * nb_out, sizeof(double));
s
->
native_one
=
av_mallocz
(
sizeof
(
int
));
if
(
!
s
->
native_one
)
return
AVERROR
(
ENOMEM
);
// for (i = 0; i < nb_out; i++)
// for (j = 0; j < nb_in; j++)
// ((double*)s->native_matrix)[i * nb_in + j] = s->matrix[i][j];
...
...
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