From adca52578d6ba5284b7df39ebdf9ed61a5e31d74 Mon Sep 17 00:00:00 2001 From: Francois-Olivier Devaux Date: Tue, 21 Aug 2007 12:21:35 +0000 Subject: [PATCH] Memory leaks fixed --- ChangeLog | 1 + libopenjpeg/j2k.c | 2 ++ libopenjpeg/t2.c | 5 +++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e4c72ec7..b8cfd620 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ August 21, 2007 * [Parvatha] Solved problems with codec reading from image file directory when filename had more than one "." in name * [Callum Lerwick] Minor cleanup patch, that gets rid of a bunch of "old style declaration" warnings from Intel's compiler * [Callum Lerwick] Aligned malloc using Intel's _mm_malloc(). Cleanup on the t1 memory allocation, getting rid of some leftover debug code +* [Callum Lerwick] Memory leaks fixed August 20, 2007 + [FOD] Added support for the TGA file format in the codec diff --git a/libopenjpeg/j2k.c b/libopenjpeg/j2k.c index 8fabbf96..f013f79a 100644 --- a/libopenjpeg/j2k.c +++ b/libopenjpeg/j2k.c @@ -2585,6 +2585,8 @@ bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, char *index) tcd_free_encode(tcd); tcd_destroy(tcd); + free(j2k->cur_totnum_tp); + j2k_write_eoc(j2k); /* Creation of the index file */ diff --git a/libopenjpeg/t2.c b/libopenjpeg/t2.c index 6c0e012b..649493c7 100644 --- a/libopenjpeg/t2.c +++ b/libopenjpeg/t2.c @@ -238,11 +238,12 @@ static int t2_encode_packet(opj_tcd_tile_t * tile, opj_tcp_t * tcp, opj_pi_itera } } } - + if (bio_flush(bio)) { + bio_destroy(bio); return -999; /* modified to eliminate longjmp !! */ } - + c += bio_numbytes(bio); bio_destroy(bio);