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
aeb73c73
Commit
aeb73c73
authored
Aug 30, 2018
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/dnxhdenc: stop leaking memory when initalization fails
Fixes #6593.
parent
56f68a09
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
dnxhdenc.c
libavcodec/dnxhdenc.c
+9
-9
dnxhdenc.h
libavcodec/dnxhdenc.h
+2
-0
No files found.
libavcodec/dnxhdenc.c
View file @
aeb73c73
...
...
@@ -207,17 +207,17 @@ static av_cold int dnxhd_init_vlc(DNXHDEncContext *ctx)
int
i
,
j
,
level
,
run
;
int
max_level
=
1
<<
(
ctx
->
bit_depth
+
2
);
FF_ALLOCZ_ARRAY_OR_GOTO
(
ctx
->
m
.
avctx
,
ctx
->
vlc_codes
,
max_level
,
4
*
sizeof
(
*
ctx
->
vlc_codes
),
fail
);
FF_ALLOCZ_ARRAY_OR_GOTO
(
ctx
->
m
.
avctx
,
ctx
->
vlc_bits
,
max_level
,
4
*
sizeof
(
*
ctx
->
vlc_bits
),
fail
);
FF_ALLOCZ_ARRAY_OR_GOTO
(
ctx
->
m
.
avctx
,
ctx
->
orig_
vlc_codes
,
max_level
,
4
*
sizeof
(
*
ctx
->
orig_
vlc_codes
),
fail
);
FF_ALLOCZ_ARRAY_OR_GOTO
(
ctx
->
m
.
avctx
,
ctx
->
orig_
vlc_bits
,
max_level
,
4
*
sizeof
(
*
ctx
->
orig_
vlc_bits
),
fail
);
FF_ALLOCZ_OR_GOTO
(
ctx
->
m
.
avctx
,
ctx
->
run_codes
,
63
*
2
,
fail
);
FF_ALLOCZ_OR_GOTO
(
ctx
->
m
.
avctx
,
ctx
->
run_bits
,
63
,
fail
);
ctx
->
vlc_codes
+=
max_level
*
2
;
ctx
->
vlc_bits
+=
max_level
*
2
;
ctx
->
vlc_codes
=
ctx
->
orig_vlc_codes
+
max_level
*
2
;
ctx
->
vlc_bits
=
ctx
->
orig_vlc_bits
+
max_level
*
2
;
for
(
level
=
-
max_level
;
level
<
max_level
;
level
++
)
{
for
(
run
=
0
;
run
<
2
;
run
++
)
{
int
index
=
(
level
<<
1
)
|
run
;
...
...
@@ -1348,11 +1348,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
static
av_cold
int
dnxhd_encode_end
(
AVCodecContext
*
avctx
)
{
DNXHDEncContext
*
ctx
=
avctx
->
priv_data
;
int
max_level
=
1
<<
(
ctx
->
bit_depth
+
2
);
int
i
;
av_free
(
ctx
->
vlc_codes
-
max_level
*
2
);
av_free
(
ctx
->
vlc_bits
-
max_level
*
2
);
av_free
p
(
&
ctx
->
orig_vlc_codes
);
av_free
p
(
&
ctx
->
orig_vlc_bits
);
av_freep
(
&
ctx
->
run_codes
);
av_freep
(
&
ctx
->
run_bits
);
...
...
@@ -1392,6 +1391,7 @@ AVCodec ff_dnxhd_encoder = {
.
encode2
=
dnxhd_encode_picture
,
.
close
=
dnxhd_encode_end
,
.
capabilities
=
AV_CODEC_CAP_SLICE_THREADS
|
AV_CODEC_CAP_FRAME_THREADS
|
AV_CODEC_CAP_INTRA_ONLY
,
.
caps_internal
=
FF_CODEC_CAP_INIT_CLEANUP
,
.
pix_fmts
=
(
const
enum
AVPixelFormat
[])
{
AV_PIX_FMT_YUV422P
,
AV_PIX_FMT_YUV422P10
,
...
...
libavcodec/dnxhdenc.h
View file @
aeb73c73
...
...
@@ -86,6 +86,8 @@ typedef struct DNXHDEncContext {
unsigned
frame_bits
;
uint8_t
*
src
[
3
];
uint32_t
*
orig_vlc_codes
;
uint8_t
*
orig_vlc_bits
;
uint32_t
*
vlc_codes
;
uint8_t
*
vlc_bits
;
uint16_t
*
run_codes
;
...
...
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