stagefright: check IMemory::pointer() before using the allocation

bug: 19779574
Change-Id: I4ffe8c3fadc07da211f421e75ee83010b01d9cbb
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 3db4a58..34bd4c7 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -698,7 +698,7 @@
 
             for (OMX_U32 i = 0; i < def.nBufferCountActual; ++i) {
                 sp<IMemory> mem = mDealer[portIndex]->allocate(def.nBufferSize);
-                if (mem.get() == NULL) {
+                if (mem == NULL || mem->pointer() == NULL) {
                     return NO_MEMORY;
                 }
 
@@ -990,7 +990,7 @@
 
         sp<IMemory> mem = mDealer[kPortIndexOutput]->allocate(
                 sizeof(struct VideoDecoderOutputMetaData));
-        if (mem.get() == NULL) {
+        if (mem == NULL || mem->pointer() == NULL) {
             return NO_MEMORY;
         }
         info.mData = new ABuffer(mem->pointer(), mem->size());