summaryrefslogtreecommitdiff
path: root/indra/llimage
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2019-12-16 13:02:08 +0000
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2019-12-16 13:02:08 +0000
commit14fdd7c4908083e7e09c97d4ddc19eb1cb92de39 (patch)
treebe4d09e4503583ebb402bd394e9fee21baef6c79 /indra/llimage
parentd0abb6e1e091e89186df1d1fe6c8256f0bac497c (diff)
parentd656d49a77eeb65ae537c954ea4009bc22da7b2b (diff)
merge
Diffstat (limited to 'indra/llimage')
-rw-r--r--indra/llimage/llimage.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp
index 9dea876114..7a0c8cd8f5 100644
--- a/indra/llimage/llimage.cpp
+++ b/indra/llimage/llimage.cpp
@@ -2168,19 +2168,27 @@ bool LLImageFormatted::load(const std::string &filename, int load_size)
}
bool res;
U8 *data = allocateData(load_size);
- apr_size_t bytes_read = load_size;
- apr_status_t s = apr_file_read(apr_file, data, &bytes_read); // modifies bytes_read
- if (s != APR_SUCCESS || (S32) bytes_read != load_size)
+ if (data)
{
- deleteData();
- setLastError("Unable to read file",filename);
- res = false;
+ apr_size_t bytes_read = load_size;
+ apr_status_t s = apr_file_read(apr_file, data, &bytes_read); // modifies bytes_read
+ if (s != APR_SUCCESS || (S32) bytes_read != load_size)
+ {
+ deleteData();
+ setLastError("Unable to read file",filename);
+ res = false;
+ }
+ else
+ {
+ res = updateData();
+ }
}
else
{
- res = updateData();
+ setLastError("Allocation failure", filename);
+ res = false;
}
-
+
return res;
}