From: Tom Hughes Date: Thu, 6 Oct 2005 12:05:06 +0000 (+0000) Subject: Merge memalign fix from trunk to stable branch. X-Git-Tag: svn/VALGRIND_3_0_1~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d6152332175b944ac4885890969812220fa62b10;p=thirdparty%2Fvalgrind.git Merge memalign fix from trunk to stable branch. git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_3_0_BRANCH@4880 --- diff --git a/coregrind/m_mallocfree.c b/coregrind/m_mallocfree.c index 0df8af917c..864a405e66 100644 --- a/coregrind/m_mallocfree.c +++ b/coregrind/m_mallocfree.c @@ -1151,6 +1151,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 );