From: Michael Niedermayer <[email protected]>

Prevent use of uninitialized memory / valgrind failure.

Found-by: ubitux
Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavcodec/jpeg2k.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/jpeg2k.c b/libavcodec/jpeg2k.c
index e8f5ff0..c27b316 100644
--- a/libavcodec/jpeg2k.c
+++ b/libavcodec/jpeg2k.c
@@ -416,9 +416,9 @@ int ff_jpeg2k_init_component(Jpeg2KComponent *comp,
                 if (!prec->zerobits)
                     return AVERROR(ENOMEM);
 
-                prec->cblk = av_malloc_array(prec->nb_codeblocks_width *
-                                             prec->nb_codeblocks_height,
-                                             sizeof(*prec->cblk));
+                prec->cblk = av_mallocz_array(prec->nb_codeblocks_width *
+                                              prec->nb_codeblocks_height,
+                                              sizeof(*prec->cblk));
                 if (!prec->cblk)
                     return AVERROR(ENOMEM);
                 for (cblkno = 0; cblkno < prec->nb_codeblocks_width * 
prec->nb_codeblocks_height; cblkno++) {
-- 
1.7.9.5

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to