summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-01-15 16:51:08 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-01-15 17:09:39 +0100
commit6c3cb02a742f0ce32a85e86738a18e3d6d711d59 (patch)
treee67ecf6595af58ddea86e1f954091374220d7da4
parent5f964c6027da4924a9d0b9a9a6ab5efa7227c189 (diff)
avcodec/flac_parser: Check for av_malloc() failure
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/flac_parser.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index bc874c558b..d16af29efd 100644
--- a/libavcodec/flac_parser.c
+++ b/libavcodec/flac_parser.c
@@ -192,6 +192,11 @@ static int find_headers_search_validate(FLACParseContext *fpc, int offset)
(*end_handle)->offset = offset;
(*end_handle)->link_penalty = av_malloc(sizeof(int) *
FLAC_MAX_SEQUENTIAL_HEADERS);
+ if (!(*end_handle)->link_penalty) {
+ av_freep(end_handle);
+ return AVERROR(ENOMEM);
+ }
+
for (i = 0; i < FLAC_MAX_SEQUENTIAL_HEADERS; i++)
(*end_handle)->link_penalty[i] = FLAC_HEADER_NOT_PENALIZED_YET;