From ea0d107859ea2ba278a17dbb250d883f61918fbb Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Wed, 18 May 2016 10:26:55 +1000 Subject: [PATCH] alloc/linear: warn on null src pointers --- alloc/linear.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/alloc/linear.cpp b/alloc/linear.cpp index 1f784a62..4755056c 100644 --- a/alloc/linear.cpp +++ b/alloc/linear.cpp @@ -28,6 +28,9 @@ linear::linear (void *begin, void *end): m_end (reinterpret_cast (end)), m_cursor (reinterpret_cast (begin)) { + CHECK_NEZ (begin); + CHECK_NEZ (end); + CHECK_LE (begin, end); } @@ -41,6 +44,8 @@ linear::allocate (size_t bytes, size_t alignment) throw std::bad_alloc (); m_cursor = ptr + bytes; + + CHECK_NEZ (ptr); return ptr; }