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
39dfe680
Commit
39dfe680
authored
Nov 12, 2014
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/dvbsubdec: Cleanup on *malloc failure
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
e74e1460
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
7 deletions
+23
-7
dvbsubdec.c
libavcodec/dvbsubdec.c
+23
-7
No files found.
libavcodec/dvbsubdec.c
View file @
39dfe680
...
...
@@ -762,6 +762,7 @@ static int save_subtitle_set(AVCodecContext *avctx, AVSubtitle *sub, int *got_ou
uint32_t
*
clut_table
;
int
i
;
int
offset_x
=
0
,
offset_y
=
0
;
int
ret
=
0
;
if
(
display_def
)
{
...
...
@@ -790,8 +791,10 @@ static int save_subtitle_set(AVCodecContext *avctx, AVSubtitle *sub, int *got_ou
if
(
sub
->
num_rects
>
0
)
{
sub
->
rects
=
av_mallocz_array
(
sizeof
(
*
sub
->
rects
),
sub
->
num_rects
);
if
(
!
sub
->
rects
)
return
AVERROR
(
ENOMEM
);
if
(
!
sub
->
rects
)
{
ret
=
AVERROR
(
ENOMEM
);
goto
fail
;
}
for
(
i
=
0
;
i
<
sub
->
num_rects
;
i
++
)
sub
->
rects
[
i
]
=
av_mallocz
(
sizeof
(
*
sub
->
rects
[
i
]));
...
...
@@ -836,16 +839,15 @@ static int save_subtitle_set(AVCodecContext *avctx, AVSubtitle *sub, int *got_ou
rect
->
pict
.
data
[
1
]
=
av_mallocz
(
AVPALETTE_SIZE
);
if
(
!
rect
->
pict
.
data
[
1
])
{
av_freep
(
&
sub
->
rects
);
return
AVERROR
(
ENOMEM
)
;
ret
=
AVERROR
(
ENOMEM
);
goto
fail
;
}
memcpy
(
rect
->
pict
.
data
[
1
],
clut_table
,
(
1
<<
region
->
depth
)
*
sizeof
(
uint32_t
));
rect
->
pict
.
data
[
0
]
=
av_malloc
(
region
->
buf_size
);
if
(
!
rect
->
pict
.
data
[
0
])
{
av_freep
(
&
rect
->
pict
.
data
[
1
]);
av_freep
(
&
sub
->
rects
);
return
AVERROR
(
ENOMEM
);
ret
=
AVERROR
(
ENOMEM
);
goto
fail
;
}
memcpy
(
rect
->
pict
.
data
[
0
],
region
->
pbuf
,
region
->
buf_size
);
...
...
@@ -855,6 +857,20 @@ static int save_subtitle_set(AVCodecContext *avctx, AVSubtitle *sub, int *got_ou
}
return
0
;
fail:
if
(
sub
->
rects
)
{
for
(
i
=
0
;
i
<
sub
->
num_rects
;
i
++
)
{
rect
=
sub
->
rects
[
i
];
if
(
rect
)
{
av_freep
(
&
rect
->
pict
.
data
[
0
]);
av_freep
(
&
rect
->
pict
.
data
[
1
]);
}
av_freep
(
&
sub
->
rects
[
i
]);
}
av_freep
(
&
sub
->
rects
);
}
sub
->
num_rects
=
0
;
return
ret
;
}
static
void
dvbsub_parse_pixel_data_block
(
AVCodecContext
*
avctx
,
DVBSubObjectDisplay
*
display
,
...
...
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