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
This commit is contained in:
George Burgess IV
2018-02-12 13:14:52 -08:00
committed by George Burgess
parent 001e6f4650
commit 4028ac9ae6

View File

@@ -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;