diff options
author | Merov Linden <merov@lindenlab.com> | 2012-10-19 17:42:22 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2012-10-19 17:42:22 -0700 |
commit | 730ba97759deabd7fb45e63eae650f83c1d9ba99 (patch) | |
tree | 2d484050ef7942ffdad6ec4636a0d35e43158917 /indra/llcommon/llmemory.h | |
parent | e6a7133ef1fa1760e0bfb53f5b14e7b6e76da0f5 (diff) | |
parent | 0356ef61cf9f70b97dc78a59fba58465d99f5fc0 (diff) |
Pull merge from richard/viewer-chui
Diffstat (limited to 'indra/llcommon/llmemory.h')
-rw-r--r-- | indra/llcommon/llmemory.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index 40cde485cf..10013e0f92 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -87,7 +87,11 @@ inline void* ll_aligned_realloc_16(void* ptr, size_t size, size_t old_size) // r void* ret = ll_aligned_malloc_16(size); if (ptr) { - memcpy(ret, ptr, old_size); + if (ret) + { + // Only copy the size of the smallest memory block to avoid memory corruption. + memcpy(ret, ptr, llmin(old_size, size)); + } ll_aligned_free_16(ptr); } return ret; |