summaryrefslogtreecommitdiff
path: root/libnativebridge
diff options
context:
space:
mode:
authorGeorge Burgess IV <gbiv@google.com>2021-04-21 06:52:02 -0700
committerGeorge Burgess IV <gbiv@google.com>2021-04-21 18:53:24 +0000
commit18584d13da8af452c79e3909617f969fc1f3f455 (patch)
treeaa65f7cf407c9f054e2fcd1a6d44f1b082aceeba /libnativebridge
parent13ab541da6fb9d56958c0aace0b4ec2b0a135427 (diff)
libnativebridge: fix a potential null deref
Caught by the static analyzer: > art/libnativebridge/native_bridge.cc:239:40: warning: Access to field 'version' results in a dereference of a null pointer (loaded from variable 'callbacks') [clang-analyzer-core.NullDereference] Bug: None Test: TreeHugger Change-Id: Ia0eb0daac6ee3b07b9ffd615cec9f0a431de2900
Diffstat (limited to 'libnativebridge')
-rw-r--r--libnativebridge/native_bridge.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/libnativebridge/native_bridge.cc b/libnativebridge/native_bridge.cc
index 7600780f79..46a05a23bf 100644
--- a/libnativebridge/native_bridge.cc
+++ b/libnativebridge/native_bridge.cc
@@ -233,10 +233,10 @@ bool LoadNativeBridge(const char* nb_library_filename,
// Store the handle for later.
native_bridge_handle = handle;
} else {
- callbacks = nullptr;
- dlclose(handle);
ALOGW("Unsupported native bridge API in %s (is version %d not compatible with %d)",
nb_library_filename, callbacks->version, NAMESPACE_VERSION);
+ callbacks = nullptr;
+ dlclose(handle);
}
} else {
dlclose(handle);