From fb4ac46d7f51cee2244e909de1c2432bdb95c08b Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 12 Apr 2014 05:40:37 +0200 Subject: [PATCH] avcodec/elbg: Use av_malloc(z)_array() Signed-off-by: Michael Niedermayer --- libavcodec/elbg.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libavcodec/elbg.c b/libavcodec/elbg.c index 11b541f210..9bbb6d88ac 100644 --- a/libavcodec/elbg.c +++ b/libavcodec/elbg.c @@ -343,7 +343,7 @@ void avpriv_init_elbg(int *points, int dim, int numpoints, int *codebook, if (numpoints > 24*numCB) { /* ELBG is very costly for a big number of points. So if we have a lot of them, get a good initial codebook to save on iterations */ - int *temp_points = av_malloc(dim*(numpoints/8)*sizeof(int)); + int *temp_points = av_malloc_array(dim, (numpoints/8)*sizeof(int)); for (i=0; idim = dim; elbg->numCB = numCB; elbg->codebook = codebook; - elbg->cells = av_malloc(numCB*sizeof(cell *)); - elbg->utility = av_malloc(numCB*sizeof(int)); + elbg->cells = av_malloc_array(numCB, sizeof(cell *)); + elbg->utility = av_malloc_array(numCB, sizeof(int)); elbg->nearest_cb = closest_cb; elbg->points = points; - elbg->utility_inc = av_malloc(numCB*sizeof(*elbg->utility_inc)); - elbg->scratchbuf = av_malloc(5*dim*sizeof(int)); + elbg->utility_inc = av_malloc_array(numCB, sizeof(*elbg->utility_inc)); + elbg->scratchbuf = av_malloc_array(5*dim, sizeof(int)); elbg->rand_state = rand_state;