From: Ivan Maidanski Date: Wed, 24 Oct 2012 03:57:45 +0000 (+0400) Subject: Check traceable_allocator.allocate result before dereference in test_cpp X-Git-Tag: gc7_4_0~177 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7edcba978ab71e11e5f5451cb280316e5325681a;p=gc Check traceable_allocator.allocate result before dereference in test_cpp * tests/test_cpp.cc (main): Check "xptr" value (obtained from traceable_allocator.allocate) for NULL (and exit with the corresponding message in that case) before dereferencing it. --- diff --git a/tests/test_cpp.cc b/tests/test_cpp.cc index ca42d247..dd11b927 100644 --- a/tests/test_cpp.cc +++ b/tests/test_cpp.cc @@ -228,6 +228,10 @@ int APIENTRY WinMain( HINSTANCE instance ATTR_UNUSED, # endif *x = 29; # ifndef DONT_USE_STD_ALLOCATOR + if (!xptr) { + fprintf(stderr, "Out of memory!\n"); + exit(3); + } *xptr = x; x = 0; # endif