[FFmpeg-cvslog] avcodec/pthread_slice: Use av_malloc(z)_array()
Michael Niedermayer
git at videolan.org
Sun Jun 8 16:39:00 CEST 2014
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Jun 8 16:34:50 2014 +0200| [4959c4a793313d0684026f14ffae61766c8b16fe] | committer: Michael Niedermayer
avcodec/pthread_slice: Use av_malloc(z)_array()
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4959c4a793313d0684026f14ffae61766c8b16fe
---
libavcodec/pthread_slice.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavcodec/pthread_slice.c b/libavcodec/pthread_slice.c
index edfe9c6..334aaac 100644
--- a/libavcodec/pthread_slice.c
+++ b/libavcodec/pthread_slice.c
@@ -201,7 +201,7 @@ int ff_slice_thread_init(AVCodecContext *avctx)
if (!c)
return -1;
- c->workers = av_mallocz(sizeof(pthread_t)*thread_count);
+ c->workers = av_mallocz_array(thread_count, sizeof(pthread_t));
if (!c->workers) {
av_free(c);
return -1;
@@ -266,15 +266,15 @@ int ff_alloc_entries(AVCodecContext *avctx, int count)
if (avctx->active_thread_type & FF_THREAD_SLICE) {
SliceThreadContext *p = avctx->internal->thread_ctx;
p->thread_count = avctx->thread_count;
- p->entries = av_mallocz(count * sizeof(int));
+ p->entries = av_mallocz_array(count, sizeof(int));
if (!p->entries) {
return AVERROR(ENOMEM);
}
p->entries_count = count;
- p->progress_mutex = av_malloc(p->thread_count * sizeof(pthread_mutex_t));
- p->progress_cond = av_malloc(p->thread_count * sizeof(pthread_cond_t));
+ p->progress_mutex = av_malloc_array(p->thread_count, sizeof(pthread_mutex_t));
+ p->progress_cond = av_malloc_array(p->thread_count, sizeof(pthread_cond_t));
for (i = 0; i < p->thread_count; i++) {
pthread_mutex_init(&p->progress_mutex[i], NULL);
More information about the ffmpeg-cvslog
mailing list