summaryrefslogtreecommitdiff
path: root/libavcodec/pthread_frame.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-06-01 02:25:04 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-06-01 02:25:04 +0200
commit6ed8341cb163e4c253449458aa21a0b3aab1e2b6 (patch)
tree918a2c8b973f38a28c540984f39c0e2021d6edb3 /libavcodec/pthread_frame.c
parent615e73ab4f8cd85e490c7d141fd710385bfaa8ac (diff)
parent0994e142132200c706f704271b5a7ae81d128f5c (diff)
Merge commit '0994e142132200c706f704271b5a7ae81d128f5c'
* commit '0994e142132200c706f704271b5a7ae81d128f5c': pthread: Check memory allocation Conflicts: libavcodec/pthread_frame.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
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 e80990558b..a3fd1fff75 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -637,8 +637,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_array(thread_count, sizeof(PerThreadContext));
+ if (!fctx->threads) {
+ av_freep(&avctx->internal->thread_ctx);
+ return AVERROR(ENOMEM);
+ }
+
pthread_mutex_init(&fctx->buffer_mutex, NULL);
fctx->delaying = 1;