From cbf8e37295581112fe19f6bd3d32ed5f6391dd1f Mon Sep 17 00:00:00 2001 From: Doyle T Date: Sun, 15 Jul 2018 21:45:50 +1000 Subject: [PATCH] Fix QuickSort regression taking a ptr to data causing memory overwrite --- dqn.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dqn.h b/dqn.h index 872e7d1..c530b10 100644 --- a/dqn.h +++ b/dqn.h @@ -930,11 +930,11 @@ DQN_FILE_SCOPE void DqnQuickSort(T *array, isize size, void *userContext) { if (!IsLessThan(array[checkIndex], array[itemToInsertIndex], userContext)) { - T *itemToInsert = array + itemToInsertIndex; + T itemToInsert = array[itemToInsertIndex]; for (i32 i = itemToInsertIndex; i > checkIndex; i--) array[i] = array[i - 1]; - array[checkIndex] = *itemToInsert; + array[checkIndex] = itemToInsert; break; } }