Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
b92dfb56
Commit
b92dfb56
authored
Sep 19, 2012
by
Alex Converse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tiffenc: Check av_malloc() results.
parent
9bc055e3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
tiffenc.c
libavcodec/tiffenc.c
+15
-1
No files found.
libavcodec/tiffenc.c
View file @
b92dfb56
...
...
@@ -316,6 +316,10 @@ static int encode_frame(AVCodecContext * avctx, AVPacket *pkt,
strip_sizes
=
av_mallocz
(
sizeof
(
*
strip_sizes
)
*
strips
);
strip_offsets
=
av_mallocz
(
sizeof
(
*
strip_offsets
)
*
strips
);
if
(
!
strip_sizes
||
!
strip_offsets
)
{
ret
=
AVERROR
(
ENOMEM
);
goto
fail
;
}
bytes_per_row
=
(((
s
->
width
-
1
)
/
s
->
subsampling
[
0
]
+
1
)
*
s
->
bpp
*
s
->
subsampling
[
0
]
*
s
->
subsampling
[
1
]
+
7
)
>>
3
;
...
...
@@ -323,6 +327,7 @@ static int encode_frame(AVCodecContext * avctx, AVPacket *pkt,
yuv_line
=
av_malloc
(
bytes_per_row
);
if
(
yuv_line
==
NULL
){
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Not enough memory
\n
"
);
ret
=
AVERROR
(
ENOMEM
);
goto
fail
;
}
}
...
...
@@ -335,6 +340,10 @@ static int encode_frame(AVCodecContext * avctx, AVPacket *pkt,
zlen
=
bytes_per_row
*
s
->
rps
;
zbuf
=
av_malloc
(
zlen
);
if
(
!
zbuf
)
{
ret
=
AVERROR
(
ENOMEM
);
goto
fail
;
}
strip_offsets
[
0
]
=
ptr
-
pkt
->
data
;
zn
=
0
;
for
(
j
=
0
;
j
<
s
->
rps
;
j
++
)
{
...
...
@@ -359,8 +368,13 @@ static int encode_frame(AVCodecContext * avctx, AVPacket *pkt,
}
else
#endif
{
if
(
s
->
compr
==
TIFF_LZW
)
if
(
s
->
compr
==
TIFF_LZW
)
{
s
->
lzws
=
av_malloc
(
ff_lzw_encode_state_size
);
if
(
!
s
->
lzws
)
{
ret
=
AVERROR
(
ENOMEM
);
goto
fail
;
}
}
for
(
i
=
0
;
i
<
s
->
height
;
i
++
)
{
if
(
strip_sizes
[
i
/
s
->
rps
]
==
0
)
{
if
(
s
->
compr
==
TIFF_LZW
){
...
...
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