]> granicus.if.org Git - openjpeg/commitdiff
[trunk] Import patch from bug #241
authorMathieu Malaterre <mathieu.malaterre@gmail.com>
Thu, 26 Sep 2013 09:28:47 +0000 (09:28 +0000)
committerMathieu Malaterre <mathieu.malaterre@gmail.com>
Thu, 26 Sep 2013 09:28:47 +0000 (09:28 +0000)
src/lib/openjp2/image.c
src/lib/openjp2/openjpeg.c

index 7e48de1a84a10349af971fa5150ca73731c37145..1b14f6852dca816c89c8c60b6794e1f71a457b1e 100644 (file)
@@ -40,7 +40,7 @@ opj_image_t* OPJ_CALLCONV opj_image_create(OPJ_UINT32 numcmpts, opj_image_cmptpa
                image->color_space = clrspc;
                image->numcomps = numcmpts;
                /* allocate memory for the per-component information */
-               image->comps = (opj_image_comp_t*)opj_malloc(image->numcomps * sizeof(opj_image_comp_t));
+               image->comps = (opj_image_comp_t*)opj_calloc(1,image->numcomps * sizeof(opj_image_comp_t));
                if(!image->comps) {
                        fprintf(stderr,"Unable to allocate memory for image.\n");
                        opj_image_destroy(image);
index e7ca5f80219cd8afb5a5323430de66a2de11ac3d..78b5a564d32a3862f76460bb9eecb3b5ea09881f 100644 (file)
@@ -850,10 +850,9 @@ OPJ_BOOL OPJ_CALLCONV opj_encode(opj_codec_t *p_info, opj_stream_t *p_stream)
                opj_stream_private_t * l_stream = (opj_stream_private_t *) p_stream;
 
                if (! l_codec->is_decompressor) {
-                       l_codec->m_codec_data.m_compression.opj_encode( l_codec->m_codec,
+                       return l_codec->m_codec_data.m_compression.opj_encode(  l_codec->m_codec,
                                                                                                                        l_stream,
                                                                                                                        &(l_codec->m_event_mgr));
-                       return OPJ_TRUE;
                }
        }