diff options
author | Merov Linden <merov@lindenlab.com> | 2011-04-14 09:28:34 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2011-04-14 09:28:34 -0700 |
commit | 8c7d9bbd064c605b756ebf4752eaefad25ee6f4f (patch) | |
tree | da8a7087bfc11369f77a9be5659437df7d2b2f7e /indra | |
parent | b77a7b4711cc9a8294ce3d20ea34f999336b0441 (diff) |
EXP-663 : Fix memory leak introduced in precincts handling
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llkdu/llimagej2ckdu.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/indra/llkdu/llimagej2ckdu.cpp b/indra/llkdu/llimagej2ckdu.cpp index 8d2ed8f8c4..5b2c045841 100644 --- a/indra/llkdu/llimagej2ckdu.cpp +++ b/indra/llkdu/llimagej2ckdu.cpp @@ -361,17 +361,23 @@ BOOL LLImageJ2CKDU::initDecode(LLImageJ2C &base, LLImageRaw &raw_image, F32 deco } int discard = (discard_level != -1 ? discard_level : base.getRawDiscardLevel()); + // Apply loading restrictions mCodeStreamp->apply_input_restrictions( first_channel, max_channel_count, discard, 0, region_kdu); + + // Clean-up + if (region_kdu) + { + delete region_kdu; + region_kdu = NULL; + } + // Resize raw_image according to the image to be decoded kdu_dims dims; mCodeStreamp->get_dims(0,dims); S32 channels = base.getComponents() - first_channel; - if (channels > max_channel_count) - { - channels = max_channel_count; - } + channels = llmin(channels,max_channel_count); raw_image.resize(dims.size.x, dims.size.y, channels); + // llinfos << "Resizing raw_image to " << dims.size.x << ":" << dims.size.y << llendl; - // llinfos << "Resizing to " << dims.size.x << ":" << dims.size.y << llendl; if (!mTileIndicesp) { mTileIndicesp = new kdu_dims; |