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
03927cb7
Commit
03927cb7
authored
May 31, 2015
by
Vittorio Giovara
Committed by
Luca Barbato
May 31, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
psymodel: Check memory allocation
parent
fef2f472
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
psymodel.c
libavcodec/psymodel.c
+12
-0
No files found.
libavcodec/psymodel.c
View file @
03927cb7
...
...
@@ -39,6 +39,12 @@ av_cold int ff_psy_init(FFPsyContext *ctx, AVCodecContext *avctx, int num_lens,
ctx
->
group
=
av_mallocz
(
sizeof
(
ctx
->
group
[
0
])
*
num_groups
);
ctx
->
bands
=
av_malloc
(
sizeof
(
ctx
->
bands
[
0
])
*
num_lens
);
ctx
->
num_bands
=
av_malloc
(
sizeof
(
ctx
->
num_bands
[
0
])
*
num_lens
);
if
(
!
ctx
->
ch
||
!
ctx
->
group
||
!
ctx
->
bands
||
!
ctx
->
num_bands
)
{
ff_psy_end
(
ctx
);
return
AVERROR
(
ENOMEM
);
}
memcpy
(
ctx
->
bands
,
bands
,
sizeof
(
ctx
->
bands
[
0
])
*
num_lens
);
memcpy
(
ctx
->
num_bands
,
num_bands
,
sizeof
(
ctx
->
num_bands
[
0
])
*
num_lens
);
...
...
@@ -98,6 +104,8 @@ av_cold struct FFPsyPreprocessContext* ff_psy_preprocess_init(AVCodecContext *av
int
i
;
float
cutoff_coeff
=
0
;
ctx
=
av_mallocz
(
sizeof
(
FFPsyPreprocessContext
));
if
(
!
ctx
)
return
NULL
;
ctx
->
avctx
=
avctx
;
if
(
avctx
->
cutoff
>
0
)
...
...
@@ -109,6 +117,10 @@ av_cold struct FFPsyPreprocessContext* ff_psy_preprocess_init(AVCodecContext *av
cutoff_coeff
,
0
.
0
,
0
.
0
);
if
(
ctx
->
fcoeffs
)
{
ctx
->
fstate
=
av_mallocz
(
sizeof
(
ctx
->
fstate
[
0
])
*
avctx
->
channels
);
if
(
!
ctx
->
fstate
)
{
av_free
(
ctx
);
return
NULL
;
}
for
(
i
=
0
;
i
<
avctx
->
channels
;
i
++
)
ctx
->
fstate
[
i
]
=
ff_iir_filter_init_state
(
FILT_ORDER
);
}
...
...
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