]> granicus.if.org Git - openjpeg/commitdiff
[trunk] realloc is misused and may leak memory (Issue#168) (complements: compilation...
authorLuc Hermitte <luc.hermitte@c-s.fr>
Thu, 23 Aug 2012 19:34:41 +0000 (19:34 +0000)
committerLuc Hermitte <luc.hermitte@c-s.fr>
Thu, 23 Aug 2012 19:34:41 +0000 (19:34 +0000)
libopenjpeg/jpwl/jpwl.c
libopenjpeg/jpwl/jpwl.h
libopenjpeg/jpwl/jpwl_lib.c
libopenjpeg/t1.c

index 8a5447fb609fb24276ea180fc5371273ca4d2aeb..abbeb2d608b63fe43f955414d7c321d75715927c 100644 (file)
@@ -164,7 +164,7 @@ void jpwl_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image) {
 opj_bool j2k_add_marker(opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len) {
 
         if (!cstr_info)
-                return;
+                return OPJ_FALSE;
 
         /* expand the list? */
         if ((cstr_info->marknum + 1) > cstr_info->maxmarknum) {
@@ -177,8 +177,8 @@ opj_bool j2k_add_marker(opj_codestream_info_t *cstr_info, unsigned short int typ
                         cstr_info->marker = 0;
                         cstr_info->marknum = 0;
                         cstr_info->maxmarknum = 0;
-                        opj_event_msg_v2(p_manager, EVT_ERROR, "Not enough memory to add a marker\n"); // TODO: find a better error message
-                        TODO_test_add_marker_result;
+                        /* opj_event_msg_v2(p_manager, EVT_ERROR, "Not enough memory to add a marker\n"); */
+                        // TODO_test_add_marker_result;
                         return OPJ_FALSE;
                 }
                 cstr_info->marker = new_marker;
index 12076283a58298e133f8e175906a58aed7f88930..52c1fbc234c854356993383ba42e9d9c8a858685 100644 (file)
@@ -336,7 +336,7 @@ opj_bool jpwl_esd_fill(opj_j2k_t *j2k, jpwl_esd_ms_t *esdmark, unsigned char *bu
 
 opj_bool jpwl_epb_fill(opj_j2k_t *j2k, jpwl_epb_ms_t *epbmark, unsigned char *buf, unsigned char *post_buf);
 
-void j2k_add_marker(opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len);
+opj_bool j2k_add_marker(opj_codestream_info_t *cstr_info, unsigned short int type, int pos, int len);
 
 /** corrects the data in the JPWL codestream
 @param j2k J2K compressor handle
index 90a71cec6799367e728c1c7b302ec407c6dea778..ee01aa058b3842d7b2c21624b4df3c73c36c087e 100644 (file)
@@ -1581,7 +1581,7 @@ opj_bool jpwl_esd_fill(opj_j2k_t *j2k, jpwl_esd_ms_t *esd, unsigned char *buf) {
        return OPJ_TRUE;
 }
 
-void jpwl_esd_write(opj_j2k_t *j2k, jpwl_esd_ms_t *esd, unsigned char *buf) {
+opj_bool jpwl_esd_write(opj_j2k_t *j2k, jpwl_esd_ms_t *esd, unsigned char *buf) {
 
        /* Marker */
        *(buf++) = (unsigned char) (J2K_MS_ESD >> 8); 
index becc41a253535bd2db8472fe91f758e1f1822fef..298bd44500a228f4b90335173dd85be50c155d55 100644 (file)
@@ -1413,7 +1413,7 @@ static opj_bool t1_decode_cblk(
                                cblk->x1 - cblk->x0,
                                cblk->y1 - cblk->y0))
        {
-               return;
+               return OPJ_FALSE;
        }
 
        bpno = roishift + cblk->numbps - 1;
@@ -1757,7 +1757,7 @@ static opj_bool t1_decode_cblk_v2(
                                cblk->x1 - cblk->x0,
                                cblk->y1 - cblk->y0))
        {
-               return;
+               return OPJ_FALSE;
        }
 
        bpno = roishift + cblk->numbps - 1;