summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Burgess IV <gbiv@google.com>2018-02-12 13:14:52 -0800
committerGeorge Burgess <gbiv@google.com>2018-02-13 00:33:26 +0000
commit4028ac9ae6f56dbd9ee0baab5b76a40ffcb740a5 (patch)
tree42ea6c045fb85eea7a417e7d3c94d6ae8b4718c2
parent001e6f4650449d576657cb4d1085cbfd743ea9b7 (diff)
downloadlibhardware-4028ac9ae6f56dbd9ee0baab5b76a40ffcb740a5.tar.gz
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
-rw-r--r--modules/gralloc/framebuffer.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/modules/gralloc/framebuffer.cpp b/modules/gralloc/framebuffer.cpp
index 97964572..c1717115 100644
--- a/modules/gralloc/framebuffer.cpp
+++ b/modules/gralloc/framebuffer.cpp
@@ -332,6 +332,8 @@ int fb_device_open(hw_module_t const* module, const char* name,
const_cast<int&>(dev->device.minSwapInterval) = 1;
const_cast<int&>(dev->device.maxSwapInterval) = 1;
*device = &dev->device.common;
+ } else {
+ free(dev);
}
}
return status;