nativewindow: report errors on error to allocate a handle
At the moment, `outBuffer` won't be set if `err == 0 && gbuffer->handle
!= nullptr`, even though we return a zero value for `err`. This causes
us to pass nullptr to AHardwareBuffer_release in
AHardwareBuffer_isSupported, which isn't correct.
Caught by the static analyzer:
> frameworks/native/libs/nativewindow/AHardwareBuffer.cpp:394:9:
warning: Null passed to a callee that requires a non-null 1st parameter
[clang-analyzer-nullability.NullPassedToNonnull]
This also replaces 0 with nullptr, since we're checking a pointer's
value here.
Bug: None
Test: TreeHugger
Change-Id: Id2fad234f98eda71b06419193e15cbfb5fa39bf1
1 file changed