Stop memalign crashing if it fails to allocate the memory. Bug 112538.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4879
This commit is contained in:
Tom Hughes 2005-10-06 12:04:26 +00:00
parent 7f18f0910d
commit c0893e8f7d

View File

@ -1200,6 +1200,10 @@ void* VG_(arena_memalign) ( ArenaId aid, SizeT req_alignB, SizeT req_pszB )
base_p = VG_(arena_malloc) ( aid, base_pszB_req );
a->bytes_on_loan = saved_bytes_on_loan;
/* Give up if we couldn't allocate enough space */
if (base_p == 0)
return 0;
/* Block ptr for the block we are going to split. */
base_b = get_payload_block ( a, base_p );