ART: Abort if malloc() fails in SwapAllocator::allocate().

Change-Id: I084da8d376b0a86fc551b87d77ce9c74e60359bf
diff --git a/compiler/utils/swap_space.h b/compiler/utils/swap_space.h
index f7c772d..9127b6b 100644
--- a/compiler/utils/swap_space.h
+++ b/compiler/utils/swap_space.h
@@ -163,7 +163,9 @@
   pointer allocate(size_type n, SwapAllocator<void>::pointer hint ATTRIBUTE_UNUSED = nullptr) {
     DCHECK_LE(n, max_size());
     if (swap_space_ == nullptr) {
-      return reinterpret_cast<T*>(malloc(n * sizeof(T)));
+      T* result = reinterpret_cast<T*>(malloc(n * sizeof(T)));
+      CHECK(result != nullptr || n == 0u);  // Abort if malloc() fails.
+      return result;
     } else {
       return reinterpret_cast<T*>(swap_space_->Alloc(n * sizeof(T)));
     }