]> git.sesse.net Git - ffmpeg/commitdiff
Merge commit '0994e142132200c706f704271b5a7ae81d128f5c'
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 1 Jun 2015 00:25:04 +0000 (02:25 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 1 Jun 2015 00:25:04 +0000 (02:25 +0200)
* commit '0994e142132200c706f704271b5a7ae81d128f5c':
  pthread: Check memory allocation

Conflicts:
libavcodec/pthread_frame.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/pthread_frame.c

index e80990558bb3159c8db4e4df1ca46fe893ca9cba,d7f742ba7d2e9ee4f84ea1fa0bb8c07aedaf80c0..a3fd1fff75828272576f55ca7cba4db1aa8e4384
@@@ -637,8 -584,15 +637,15 @@@ int ff_frame_thread_init(AVCodecContex
      }
  
      avctx->internal->thread_ctx = fctx = av_mallocz(sizeof(FrameThreadContext));
+     if (!fctx)
+         return AVERROR(ENOMEM);
  
 -    fctx->threads = av_mallocz(sizeof(PerThreadContext) * thread_count);
 +    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;