ABuffer: reset members when memory allocation fails.

Bug: 22077698
Change-Id: I2beb724662d041ad2339d0f4c7f983e7ac5e5e6f
(cherry picked from commit 94b0badc025b14141ff234e3e4e2745411742bac)
diff --git a/media/libstagefright/foundation/ABuffer.cpp b/media/libstagefright/foundation/ABuffer.cpp
index b214870..4913fd4 100644
--- a/media/libstagefright/foundation/ABuffer.cpp
+++ b/media/libstagefright/foundation/ABuffer.cpp
@@ -25,12 +25,17 @@
 
 ABuffer::ABuffer(size_t capacity)
     : mMediaBufferBase(NULL),
-      mData(malloc(capacity)),
-      mCapacity(capacity),
       mRangeOffset(0),
-      mRangeLength(capacity),
       mInt32Data(0),
       mOwnsData(true) {
+    mData = malloc(capacity);
+    if (mData == NULL) {
+        mCapacity = 0;
+        mRangeLength = 0;
+    } else {
+        mCapacity = capacity;
+        mRangeLength = capacity;
+    }
 }
 
 ABuffer::ABuffer(void *data, size_t capacity)