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
e1ea365f
Commit
e1ea365f
authored
May 31, 2015
by
Vittorio Giovara
Committed by
Luca Barbato
May 31, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
truemotion2: Check memory allocation
parent
28fb80dc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
truemotion2.c
libavcodec/truemotion2.c
+10
-0
No files found.
libavcodec/truemotion2.c
View file @
e1ea365f
...
...
@@ -171,6 +171,10 @@ static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code)
huff
.
nums
=
av_mallocz
(
huff
.
max_num
*
sizeof
(
int
));
huff
.
bits
=
av_mallocz
(
huff
.
max_num
*
sizeof
(
uint32_t
));
huff
.
lens
=
av_mallocz
(
huff
.
max_num
*
sizeof
(
int
));
if
(
!
huff
.
nums
||
!
huff
.
bits
||
!
huff
.
lens
)
{
res
=
AVERROR
(
ENOMEM
);
goto
out
;
}
res
=
tm2_read_tree
(
ctx
,
0
,
0
,
&
huff
);
...
...
@@ -193,10 +197,16 @@ static int tm2_build_huff_table(TM2Context *ctx, TM2Codes *code)
code
->
bits
=
huff
.
max_bits
;
code
->
length
=
huff
.
max_num
;
code
->
recode
=
av_malloc
(
code
->
length
*
sizeof
(
int
));
if
(
!
code
->
recode
)
{
res
=
AVERROR
(
ENOMEM
);
goto
out
;
}
for
(
i
=
0
;
i
<
code
->
length
;
i
++
)
code
->
recode
[
i
]
=
huff
.
nums
[
i
];
}
}
out:
/* free allocated memory */
av_free
(
huff
.
nums
);
av_free
(
huff
.
bits
);
...
...
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