summaryrefslogtreecommitdiff
path: root/core/src/fxcodec/fx_libopenjpeg
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-05-18 15:53:57 -0700
committerTom Sepez <tsepez@chromium.org>2015-05-18 15:53:57 -0700
commite42655964be98606d8832e816f05efbb34b42b42 (patch)
tree3f948e497f121101fe6733c9b03a2138082b97cf /core/src/fxcodec/fx_libopenjpeg
parentdfa2c9939a85ad1c01ef858b21942ab3773dcf27 (diff)
downloadpdfium-e42655964be98606d8832e816f05efbb34b42b42.tar.xz
Merge to XFA: Cleanup if early return from opj_j2k_copy_default_tcp_and_create_tcd().
Original Review URL: https://codereview.chromium.org/1138033007 BUG=486538 TBR=jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/1142133002
Diffstat (limited to 'core/src/fxcodec/fx_libopenjpeg')
-rw-r--r--core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/j2k.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/j2k.c b/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/j2k.c
index 73dc5ab6fd..c40ecc370d 100644
--- a/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/j2k.c
+++ b/core/src/fxcodec/fx_libopenjpeg/libopenjpeg20/j2k.c
@@ -7352,6 +7352,12 @@ static OPJ_BOOL opj_j2k_copy_default_tcp_and_create_tcd ( opj_j2k_t * p_j2
/* Initialize some values of the current tile coding parameters*/
l_tcp->ppt = 0;
l_tcp->ppt_data = 00;
+ /* Remove memory not owned by this tile in case of early error return. */
+ l_tcp->m_mct_decoding_matrix = 00;
+ l_tcp->m_nb_max_mct_records = 0;
+ l_tcp->m_mct_records = 00;
+ l_tcp->m_nb_max_mcc_records = 0;
+ l_tcp->m_mcc_records = 00;
/* Reconnect the tile-compo coding parameters pointer to the current tile coding parameters*/
l_tcp->tccps = l_current_tccp;
@@ -7389,6 +7395,9 @@ static OPJ_BOOL opj_j2k_copy_default_tcp_and_create_tcd ( opj_j2k_t * p_j2
++l_src_mct_rec;
++l_dest_mct_rec;
+
+ /* Update with each pass to free exactly what has been allocated on early return. */
+ l_tcp->m_nb_max_mct_records += 1;
}
/* Get the mcc_record of the dflt_tile_cp and copy them into the current tile cp*/
@@ -7398,6 +7407,7 @@ static OPJ_BOOL opj_j2k_copy_default_tcp_and_create_tcd ( opj_j2k_t * p_j2
return OPJ_FALSE;
}
memcpy(l_tcp->m_mcc_records,l_default_tcp->m_mcc_records,l_mcc_records_size);
+ l_tcp->m_nb_max_mcc_records = l_default_tcp->m_nb_max_mcc_records;
/* Copy the mcc record data from dflt_tile_cp to the current tile*/
l_src_mcc_rec = l_default_tcp->m_mcc_records;