display: Reset metadata pointer to NULL during unmap.
Initialize metadata pointer in the buffer handle to NULL after
unmapping the buffer pointer
Change-Id: I930a2d21a6f259426949d7aa58bd07f1f58839c0
CRs-Fixed: 434388
diff --git a/libgralloc/mapper.cpp b/libgralloc/mapper.cpp
index 197c372..b3e371a 100644
--- a/libgralloc/mapper.cpp
+++ b/libgralloc/mapper.cpp
@@ -117,7 +117,10 @@
}
}
}
+ /* need to initialize the pointer to NULL otherwise unmapping for that
+ * buffer happens twice which leads to crash */
hnd->base = 0;
+ hnd->base_metadata = 0;
return 0;
}
@@ -144,6 +147,7 @@
private_handle_t* hnd = (private_handle_t*)handle;
hnd->base = 0;
+ hnd->base_metadata = 0;
void *vaddr;
int err = gralloc_map(module, handle, &vaddr);
if (err) {
@@ -190,6 +194,7 @@
gralloc_unmap(module, handle);
}
hnd->base = 0;
+ hnd->base_metadata = 0;
// Release the genlock
if (-1 != hnd->genlockHandle) {
return genlock_release_lock((native_handle_t *)handle);