avcodec/flac_parser: Check for av_malloc() failure
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 15 Jan 2015 15:51:08 +0000 (16:51 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 15 Jan 2015 16:09:39 +0000 (17:09 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/flac_parser.c

index bc874c558bba6b9ecc19f3a72269825bb2431e79..d16af29efd478d788da251c8b43582d6ce7ca3f8 100644 (file)
@@ -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;