From d81d0433a5482602a7cdae590b3a0ffdc5cb79f9 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Fri, 31 Aug 2012 15:27:38 -0500
Subject: [PATCH] MAINT-1503 Fix for ll_aligned_realloc returning non-aligned
 pointers on linux

---
 indra/llcommon/llmemory.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h
index 6a2323e7d87..ebef3f98d6a 100644
--- a/indra/llcommon/llmemory.h
+++ b/indra/llcommon/llmemory.h
@@ -68,7 +68,11 @@ inline void* ll_aligned_realloc_16(void* ptr, size_t size) // returned hunk MUST
 #elif defined(LL_DARWIN)
 	return realloc(ptr,size); // default osx malloc is 16 byte aligned.
 #else
-	return realloc(ptr,size); // FIXME not guaranteed to be aligned.
+	//FIXME: memcpy is SLOW
+	void* ret = ll_aligned_malloc_16(size);
+	memcpy(ret, ptr, old_size);
+	ll_aligned_free_16(ptr);
+	return ret;
 #endif
 }
 
-- 
GitLab