summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormayeut <mayeut@users.noreply.github.com>2015-09-17 12:41:41 +0200
committermayeut <mayeut@users.noreply.github.com>2015-09-17 12:41:41 +0200
commitc16c91797f4b15eb55d56f85fd497d588331e71f (patch)
tree7507eaca15e498a86e2e13ecf132819c535bc72c /src
parenta4e93c3b0af1c42770206b5d25014a05a60ec8f5 (diff)
Fix resource leak in opj_j2k_encode
Fixes #598
Diffstat (limited to 'src')
-rw-r--r--src/lib/openjp2/j2k.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c
index e733c645..ec3635b6 100644
--- a/src/lib/openjp2/j2k.c
+++ b/src/lib/openjp2/j2k.c
@@ -9999,11 +9999,15 @@ OPJ_BOOL opj_j2k_encode(opj_j2k_t * p_j2k,
/* now copy this data into the tile component */
if (! opj_tcd_copy_tile_data(p_j2k->m_tcd,l_current_data,l_current_tile_size)) {
opj_event_msg(p_manager, EVT_ERROR, "Size mismatch between tile data and sent data." );
+ opj_free(l_current_data);
return OPJ_FALSE;
}
}
if (! opj_j2k_post_write_tile (p_j2k,p_stream,p_manager)) {
+ if (l_current_data) {
+ opj_free(l_current_data);
+ }
return OPJ_FALSE;
}
}