-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle remaining JNI calls error handling #1092
Conversation
2cdeb94
to
b5b16d3
Compare
72c392d
to
b661294
Compare
bc7213f
to
0738da9
Compare
Android notifier sizes
Generated by 🚫 Danger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are many functions that have existing/new leak issues that can be fixed with c-style RAII. We should probably just convert everything over once and for all...
// get the breadcrumb type | ||
jobject jtype = bsg_safe_get_static_object_field(env, type_class, crumb_type); | ||
if (jtype == NULL) { | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will crumb_type
leak here?
bsg_safe_new_object(env, trace_class, trace_constructor, class, method, | ||
filename, frame.line_number); | ||
if (jframe == NULL) { | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trace
will leak here
jobject jseverity = | ||
bsg_safe_get_static_object_field(env, severity_class, severity_field); | ||
if (jseverity == NULL) { | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These will leak things as well. This should probably be a c-style RAII
env, jni_cache->arraylist, jni_cache->arraylist_init_with_obj, keyset); | ||
if (keylist == NULL) { | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These will leak things. Should be c-style RAII
1c30044
to
0c872c3
Compare
0c872c3
to
8bb86a9
Compare
Thanks @kstenerud - I've updated the changeset so that the functions use RAII where it seemed appropriate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Goal
Checks additional JNI calls in the NDK module for pending exceptions and no-ops, building on #1088. This is achieved by calling ExceptionClear to remove any pending JVM exceptions that could lead to app termination.
Changeset
Added safe versions of the following methods and updated code to check the return value where appropriate:
Testing
Relied on existing test coverage.