summaryrefslogtreecommitdiff
path: root/indra/llcommon/llmemory.h
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2016-10-17 14:58:29 -0700
committerRider Linden <rider@lindenlab.com>2016-10-17 14:58:29 -0700
commit38d06dcce66ce3a7f5a7a1521f0305dbc0ea0bc5 (patch)
tree38745f1a60a13b496014a64690e7afda14611830 /indra/llcommon/llmemory.h
parentb2eded73b9bf55e2253a9c39113ff0598c2c18cb (diff)
parent086c1342152895da28d2e0130d09432152604ca8 (diff)
Merged lindenlab/viewer-release into default
Diffstat (limited to 'indra/llcommon/llmemory.h')
-rw-r--r--indra/llcommon/llmemory.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h
index 0fb257aab1..575edddc43 100644
--- a/indra/llcommon/llmemory.h
+++ b/indra/llcommon/llmemory.h
@@ -110,11 +110,15 @@ template <typename T> T* LL_NEXT_ALIGNED_ADDRESS_64(T* address)
#if defined(LL_WINDOWS)
return _aligned_malloc(size, align);
#else
+ char* aligned = NULL;
void* mem = malloc( size + (align - 1) + sizeof(void*) );
- char* aligned = ((char*)mem) + sizeof(void*);
- aligned += align - ((uintptr_t)aligned & (align - 1));
+ if (mem)
+ {
+ aligned = ((char*)mem) + sizeof(void*);
+ aligned += align - ((uintptr_t)aligned & (align - 1));
- ((void**)aligned)[-1] = mem;
+ ((void**)aligned)[-1] = mem;
+ }
return aligned;
#endif
}