[FFmpeg-cvslog] avcodec/flac_parser: Check for av_malloc() failure

Michael Niedermayer git at videolan.org
Thu Jan 15 18:02:45 CET 2015


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Jan 15 16:51:08 2015 +0100| [6c3cb02a742f0ce32a85e86738a18e3d6d711d59] | committer: Michael Niedermayer

avcodec/flac_parser: Check for av_malloc() failure

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6c3cb02a742f0ce32a85e86738a18e3d6d711d59
---

 libavcodec/flac_parser.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/flac_parser.c b/libavcodec/flac_parser.c
index bc874c5..d16af29 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;
 



More information about the ffmpeg-cvslog mailing list