From 7a88c139466c2dd0bb25d42b108d1aeb93cc66dc Mon Sep 17 00:00:00 2001 From: Jakob Botsch Nielsen Date: Wed, 13 Jul 2016 11:30:13 +0200 Subject: [PATCH] Add an assertion for alloc in rcIntArray::doResize (#219) Fix #170 --- Recast/Source/RecastAlloc.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Recast/Source/RecastAlloc.cpp b/Recast/Source/RecastAlloc.cpp index ee1039f..453b5fa 100644 --- a/Recast/Source/RecastAlloc.cpp +++ b/Recast/Source/RecastAlloc.cpp @@ -19,6 +19,7 @@ #include #include #include "RecastAlloc.h" +#include "RecastAssert.h" static void *rcAllocDefault(size_t size, rcAllocHint) { @@ -77,6 +78,7 @@ void rcIntArray::doResize(int n) if (!m_cap) m_cap = n; while (m_cap < n) m_cap *= 2; int* newData = (int*)rcAlloc(m_cap*sizeof(int), RC_ALLOC_TEMP); + rcAssert(newData); if (m_size && newData) memcpy(newData, m_data, m_size*sizeof(int)); rcFree(m_data); m_data = newData;