Camera: fix null pointer dereference
Test: N/A (no device to repro)
Bug: 128569845
Change-Id: Iff13846b6d2d0e9472d8d5b5af256aae1f744535
diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp
index 61d5031..b499981 100644
--- a/core/jni/android_hardware_Camera.cpp
+++ b/core/jni/android_hardware_Camera.cpp
@@ -256,6 +256,10 @@
ssize_t offset;
size_t size;
sp<IMemoryHeap> heap = dataPtr->getMemory(&offset, &size);
+ if (heap == NULL) {
+ ALOGV("copyAndPost: skipping null memory callback!");
+ return;
+ }
ALOGV("copyAndPost: off=%zd, size=%zu", offset, size);
uint8_t *heapBase = (uint8_t*)heap->base();