From e5ef898728b5881eb1f233aa4e0dc9dbbd0991a5 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Mon, 27 Nov 2017 15:02:33 +0200 Subject: MAINT-8028 Fixed memory leak in allocateDataSize() --- indra/llimage/llimage.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/llimage') diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 04085eb703..0fa0ef79d9 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -748,7 +748,11 @@ U8* LLImageBase::allocateData(S32 size) { size = 0; mWidth = mHeight = 0; - mData = NULL; + if (mData) + { + deleteData(); // virtual + mData = NULL; + } } mDataSize = size; claimMem(mDataSize); @@ -775,6 +779,7 @@ U8* LLImageBase::reallocateData(S32 size) disclaimMem(mDataSize); mDataSize = size; claimMem(mDataSize); + mBadBufferAllocation = false; return mData; } -- cgit v1.2.3 From 34d3b49d1f6ae7e07d615cb1f98d5ad45fbb638d Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 5 Dec 2017 17:54:17 +0200 Subject: MAINT-2124 Texture allocation issues --- indra/llimage/llimagej2c.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'indra/llimage') diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 68694496bc..c40df009d8 100644 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -369,19 +369,28 @@ bool LLImageJ2C::loadAndValidate(const std::string &filename) else { U8 *data = (U8*)ALLOCATE_MEM(LLImageBase::getPrivatePool(), file_size); - apr_size_t bytes_read = file_size; - apr_status_t s = apr_file_read(apr_file, data, &bytes_read); // modifies bytes_read - infile.close() ; - - if (s != APR_SUCCESS || (S32)bytes_read != file_size) + if (!data) { - FREE_MEM(LLImageBase::getPrivatePool(), data); - setLastError("Unable to read entire file"); + infile.close(); + setLastError("Out of memory", filename); res = false; } else { - res = validate(data, file_size); + apr_size_t bytes_read = file_size; + apr_status_t s = apr_file_read(apr_file, data, &bytes_read); // modifies bytes_read + infile.close(); + + if (s != APR_SUCCESS || (S32)bytes_read != file_size) + { + FREE_MEM(LLImageBase::getPrivatePool(), data); + setLastError("Unable to read entire file"); + res = false; + } + else + { + res = validate(data, file_size); + } } } -- cgit v1.2.3 From 6ac2b2bb4f569b6663607894034b4ec64804e905 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Wed, 10 Jan 2018 18:51:20 +0200 Subject: MAINT-8167 Fixed uploading JPEG image from Unicode directory fails --- indra/llimage/llimagedimensionsinfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llimage') diff --git a/indra/llimage/llimagedimensionsinfo.cpp b/indra/llimage/llimagedimensionsinfo.cpp index a5e546e977..97b543f3b6 100644 --- a/indra/llimage/llimagedimensionsinfo.cpp +++ b/indra/llimage/llimagedimensionsinfo.cpp @@ -163,7 +163,7 @@ bool LLImageDimensionsInfo::getImageDimensionsJpeg() { sJpegErrorEncountered = false; clean(); - FILE *fp = fopen (mSrcFilename.c_str(), "rb"); + FILE *fp = LLFile::fopen(mSrcFilename, "rb"); if (fp == NULL) { setLastError("Unable to open file for reading", mSrcFilename); -- cgit v1.2.3