Fix a memory leak
If status < 0, we'd silently leak dev.
Bug: None
Test: Ran the analyzer; memory leak warnings are gone.
Change-Id: I76a78feea4c92aa167de908f5571481864d61d73
diff --git a/modules/gralloc/framebuffer.cpp b/modules/gralloc/framebuffer.cpp
index 9796457..c171711 100644
--- a/modules/gralloc/framebuffer.cpp
+++ b/modules/gralloc/framebuffer.cpp
@@ -332,6 +332,8 @@
const_cast<int&>(dev->device.minSwapInterval) = 1;
const_cast<int&>(dev->device.maxSwapInterval) = 1;
*device = &dev->device.common;
+ } else {
+ free(dev);
}
}
return status;