]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Stop memalign crashing if it fails to allocate the memory. Bug 112538.
authorTom Hughes <tom@compton.nu>
Thu, 6 Oct 2005 12:04:26 +0000 (12:04 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 6 Oct 2005 12:04:26 +0000 (12:04 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4879

coregrind/m_mallocfree.c

index 0be3f1b355684945006e286baf15eea68817c264..47c487333907e2ec9f9f67b12c98e43788966e71 100644 (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 );