[trunk] realloc is misused and may leak memory (Issue#168) (complements: compilation errors)

This commit is contained in:
Luc Hermitte 2012-08-23 19:34:41 +00:00
parent 4e81ea2a8a
commit 5820e97abe
4 changed files with 7 additions and 7 deletions

View 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;

View 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

View 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);

View 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;