From a46a7f2126fb2e04f5526863b9c19c66d827d020 Mon Sep 17 00:00:00 2001 From: Drake Arconis <drake@alchemyviewer.org> Date: Wed, 17 May 2017 11:36:53 -0400 Subject: [PATCH] Cleanup and really fix that leak in the outfit gallery --- indra/newview/lloutfitgallery.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index eef206b7bf..730311f0d5 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -1091,14 +1091,12 @@ void LLOutfitGallery::uploadPhoto(LLUUID outfit_id) LLFilePicker& picker = LLFilePicker::instance(); if (picker.getOpenFile(LLFilePicker::FFLOAD_IMAGE)) { - std::string filename = picker.getFirstFile(); - LLLocalBitmap* unit = new LLLocalBitmap(filename); - if (unit->getValid()) - { - delete unit; - std::string exten = gDirUtilp->getExtension(filename); - U32 codec = LLImageBase::getCodecFromExtension(exten); + const std::string filename = picker.getFirstFile(); + const std::string exten = gDirUtilp->getExtension(filename); + const U32 codec = LLImageBase::getCodecFromExtension(exten); + if (codec != IMG_CODEC_INVALID) + { LLImageDimensionsInfo image_info; std::string image_load_error; if (!image_info.load(filename, codec)) @@ -1106,14 +1104,11 @@ void LLOutfitGallery::uploadPhoto(LLUUID outfit_id) image_load_error = image_info.getLastError(); } - S32 max_width = MAX_OUTFIT_PHOTO_WIDTH; - S32 max_height = MAX_OUTFIT_PHOTO_HEIGHT; - - if ((image_info.getWidth() > max_width) || (image_info.getHeight() > max_height)) + if ((image_info.getWidth() > MAX_OUTFIT_PHOTO_WIDTH) || (image_info.getHeight() > MAX_OUTFIT_PHOTO_HEIGHT)) { LLStringUtil::format_map_t args; - args["WIDTH"] = llformat("%d", max_width); - args["HEIGHT"] = llformat("%d", max_height); + args["WIDTH"] = llformat("%d", MAX_OUTFIT_PHOTO_WIDTH); + args["HEIGHT"] = llformat("%d", MAX_OUTFIT_PHOTO_HEIGHT); image_load_error = LLTrans::getString("outfit_photo_load_dimensions_error", args); } -- GitLab