WIP: remove memory leak about new jp2_read_marker function

This commit is contained in:
Mickael Savinaud 2011-10-20 13:18:52 +00:00
parent 45d813b62c
commit b8214e260c
3 changed files with 24 additions and 0 deletions

View File

@ -6,6 +6,7 @@ What's New for OpenJPEG
+ : added + : added
October 20, 2011 October 20, 2011
* [mickael] WIP: remove memory leak about new jp2_read_marker function
* [mickael] WIP: remove previous commit about memory leak with ppm read function * [mickael] WIP: remove previous commit about memory leak with ppm read function
* [mickael] WIP: solve memory leak with ppm read function * [mickael] WIP: solve memory leak with ppm read function

View File

@ -7716,6 +7716,7 @@ opj_bool j2k_decode_tiles ( opj_j2k_v2_t *p_j2k,
&l_go_on, &l_go_on,
p_stream, p_stream,
p_manager)) { p_manager)) {
opj_free(l_current_data);
return OPJ_FALSE; return OPJ_FALSE;
} }

View File

@ -2570,11 +2570,33 @@ void jp2_destroy(opj_jp2_v2_t *jp2)
} }
if (jp2->color.jp2_cdef) { if (jp2->color.jp2_cdef) {
if (jp2->color.jp2_cdef->info) {
opj_free(jp2->color.jp2_cdef->info);
jp2->color.jp2_cdef->info = NULL;
}
opj_free(jp2->color.jp2_cdef); opj_free(jp2->color.jp2_cdef);
jp2->color.jp2_cdef = 00; jp2->color.jp2_cdef = 00;
} }
if (jp2->color.jp2_pclr) { if (jp2->color.jp2_pclr) {
if (jp2->color.jp2_pclr->cmap) {
opj_free(jp2->color.jp2_pclr->cmap);
jp2->color.jp2_pclr->cmap = NULL;
}
if (jp2->color.jp2_pclr->channel_sign) {
opj_free(jp2->color.jp2_pclr->channel_sign);
jp2->color.jp2_pclr->channel_sign = NULL;
}
if (jp2->color.jp2_pclr->channel_size) {
opj_free(jp2->color.jp2_pclr->channel_size);
jp2->color.jp2_pclr->channel_size = NULL;
}
if (jp2->color.jp2_pclr->entries) {
opj_free(jp2->color.jp2_pclr->entries);
jp2->color.jp2_pclr->entries = NULL;
}
opj_free(jp2->color.jp2_pclr); opj_free(jp2->color.jp2_pclr);
jp2->color.jp2_pclr = 00; jp2->color.jp2_pclr = 00;
} }