Camera: fix null pointer dereference

Test: N/A (no device to repro)
Bug: 128569845
Change-Id: Iff13846b6d2d0e9472d8d5b5af256aae1f744535
This commit is contained in:
Yin-Chia Yeh
2019-04-18 15:55:05 -07:00
parent 0cae839130
commit 3ef060eff5

View File

@@ -256,6 +256,10 @@ void JNICameraContext::copyAndPost(JNIEnv* env, const sp<IMemory>& dataPtr, int
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();