libgralloc1: Initialize stride and height from handle by default
Initialize stride/height with width/height of handle by default to
avoid returning invalid values to the client.
Change-Id: Iefa488fb50bbbb6aa9c6daf86af3f64092e56344
CRs-Fixed: 2073298
diff --git a/libgralloc1/gr_buf_mgr.cpp b/libgralloc1/gr_buf_mgr.cpp
index 16f5635..230aa4f 100644
--- a/libgralloc1/gr_buf_mgr.cpp
+++ b/libgralloc1/gr_buf_mgr.cpp
@@ -625,6 +625,9 @@
BufferDim_t buffer_dim;
int interlaced = 0;
+
+ *stride = hnd->width;
+ *height = hnd->height;
if (getMetaData(hnd, GET_BUFFER_GEOMETRY, &buffer_dim) == 0) {
*stride = buffer_dim.sliceWidth;
*height = buffer_dim.sliceHeight;
@@ -638,9 +641,6 @@
*stride = static_cast<int>(alignedw);
*height = static_cast<int>(alignedh * 2);
}
- } else {
- *stride = hnd->width;
- *height = hnd->height;
}
} break;