1
From 59a22afa0b50b9037133a7bc26bdc5023e7e1df9 Mon Sep 17 00:00:00 2001
2
From: Dustin Brody <libav@parsoma.net>
3
Date: Thu, 11 Aug 2011 08:57:58 -0400
4
Subject: [PATCH 29/70] h264: notice memory allocation failure
6
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
7
(cherry picked from commit bac3ab13ea6a9dd8853e79ef3eacf51d234c8774)
9
Signed-off-by: Anton Khirnov <anton@khirnov.net>
11
libavcodec/h264.c | 10 ++++++++--
12
1 files changed, 8 insertions(+), 2 deletions(-)
14
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
15
index 2c000a3..99be210 100644
16
--- a/libavcodec/h264.c
17
+++ b/libavcodec/h264.c
18
@@ -1165,7 +1165,10 @@ static int decode_update_thread_context(AVCodecContext *dst, const AVCodecContex
19
memcpy(&h->s + 1, &h1->s + 1, sizeof(H264Context) - sizeof(MpegEncContext)); //copy all fields after MpegEnc
20
memset(h->sps_buffers, 0, sizeof(h->sps_buffers));
21
memset(h->pps_buffers, 0, sizeof(h->pps_buffers));
22
- ff_h264_alloc_tables(h);
23
+ if (ff_h264_alloc_tables(h) < 0) {
24
+ av_log(dst, AV_LOG_ERROR, "Could not allocate memory for h264\n");
25
+ return AVERROR(ENOMEM);
30
@@ -2635,7 +2638,10 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
31
h->prev_interlaced_frame = 1;
34
- ff_h264_alloc_tables(h);
35
+ if (ff_h264_alloc_tables(h) < 0) {
36
+ av_log(h->s.avctx, AV_LOG_ERROR, "Could not allocate memory for h264\n");
37
+ return AVERROR(ENOMEM);
40
if (!HAVE_THREADS || !(s->avctx->active_thread_type&FF_THREAD_SLICE)) {
41
if (context_init(h) < 0) {