summaryrefslogtreecommitdiff
path: root/libavcodec/pthread_frame.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2015-05-31 14:55:06 +0200
committerLuca Barbato <lu_zero@gentoo.org>2015-05-31 15:03:31 +0200
commit0994e142132200c706f704271b5a7ae81d128f5c (patch)
tree3e72e7a6e515a01de5450e24c92f2b2156b60fcc /libavcodec/pthread_frame.c
parent03927cb73399e6f07185fc7f8851d7612b4187b6 (diff)
pthread: Check memory allocation
Diffstat (limited to 'libavcodec/pthread_frame.c')
-rw-r--r--libavcodec/pthread_frame.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index effc9a5ac3..d7f742ba7d 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -584,8 +584,15 @@ int ff_frame_thread_init(AVCodecContext *avctx)
}
avctx->internal->thread_ctx = fctx = av_mallocz(sizeof(FrameThreadContext));
+ if (!fctx)
+ return AVERROR(ENOMEM);
fctx->threads = av_mallocz(sizeof(PerThreadContext) * thread_count);
+ if (!fctx->threads) {
+ av_freep(&avctx->internal->thread_ctx);
+ return AVERROR(ENOMEM);
+ }
+
pthread_mutex_init(&fctx->buffer_mutex, NULL);
fctx->delaying = 1;