summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuc Hermitte <luc.hermitte@c-s.fr>2012-08-23 19:34:41 +0000
committerLuc Hermitte <luc.hermitte@c-s.fr>2012-08-23 19:34:41 +0000
commit5820e97abe6013d5e20bd8dea9b97990ea457543 (patch)
tree7625555ffa5f1bc0a9eeb8ed79fbe004e965b131
parent4e81ea2a8aca513fda983d5e943a111e27938f9c (diff)
[trunk] realloc is misused and may leak memory (Issue#168) (complements: compilation errors)
-rw-r--r--libopenjpeg/jpwl/jpwl.c6
-rw-r--r--libopenjpeg/jpwl/jpwl.h2
-rw-r--r--libopenjpeg/jpwl/jpwl_lib.c2
-rw-r--r--libopenjpeg/t1.c4
4 files changed, 7 insertions, 7 deletions
diff --git a/libopenjpeg/jpwl/jpwl.c b/libopenjpeg/jpwl/jpwl.c
index 8a5447fb..abbeb2d6 100644
--- a/libopenjpeg/jpwl/jpwl.c
+++ b/libopenjpeg/jpwl/jpwl.c
@@ -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;
diff --git a/libopenjpeg/jpwl/jpwl.h b/libopenjpeg/jpwl/jpwl.h
index 12076283..52c1fbc2 100644
--- a/libopenjpeg/jpwl/jpwl.h
+++ b/libopenjpeg/jpwl/jpwl.h
@@ -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
diff --git a/libopenjpeg/jpwl/jpwl_lib.c b/libopenjpeg/jpwl/jpwl_lib.c
index 90a71cec..ee01aa05 100644
--- a/libopenjpeg/jpwl/jpwl_lib.c
+++ b/libopenjpeg/jpwl/jpwl_lib.c
@@ -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);
diff --git a/libopenjpeg/t1.c b/libopenjpeg/t1.c
index becc41a2..298bd445 100644
--- a/libopenjpeg/t1.c
+++ b/libopenjpeg/t1.c
@@ -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;