[FFmpeg-devel] [PATCH 3/6] libopenjpegenc: Merge av_malloc() and memset(0)

Michael Niedermayer michaelni at gmx.at
Fri Nov 18 02:32:53 CET 2011


Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavcodec/libopenjpegenc.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c
index 31d87e7..13b5456 100644
--- a/libavcodec/libopenjpegenc.c
+++ b/libavcodec/libopenjpegenc.c
@@ -105,12 +105,11 @@ static opj_image_t *mj2_create_image(AVCodecContext *avctx, opj_cparameters_t *p
         return NULL;
     }
 
-    cmptparm = av_malloc(numcomps * sizeof(opj_image_cmptparm_t));
+    cmptparm = av_mallocz(numcomps * sizeof(opj_image_cmptparm_t));
     if (!cmptparm) {
         av_log(avctx, AV_LOG_ERROR, "Not enough memory");
         return NULL;
     }
-    memset(cmptparm, 0, numcomps * sizeof(opj_image_cmptparm_t));
     for (i = 0; i < numcomps; i++) {
         cmptparm[i].prec = 8;
         cmptparm[i].bpp = bpp;
-- 
1.7.4.1



More information about the ffmpeg-devel mailing list