commit | 7e424846107bfd345d1a217af09ec95392844d67 | [log] [tgz] |
---|---|---|
author | Elliott Hughes <enh@google.com> | Tue Nov 12 20:20:42 2019 -0800 |
committer | Elliott Hughes <enh@google.com> | Tue Nov 12 20:23:55 2019 -0800 |
tree | 4fe2e357d43a39fc329d9684395c54cedd149238 | |
parent | 0bc3f6b124c22477f052245c6461bd254b374dd3 [diff] [blame] |
Ignore nullptr in native_handle_close(). Just like native_handle_delete(). Bug: http://b/143898343 Test: new test Change-Id: I373067aa6c2b03548b218c7011bdbf23bd71f260
diff --git a/libcutils/native_handle.cpp b/libcutils/native_handle.cpp index b409e5b..5804ab1 100644 --- a/libcutils/native_handle.cpp +++ b/libcutils/native_handle.cpp
@@ -81,6 +81,8 @@ } int native_handle_close(const native_handle_t* h) { + if (!h) return 0; + if (h->version != sizeof(native_handle_t)) return -EINVAL; int saved_errno = errno;