Skip to content

Commit

Permalink
Fix Segfault while Releasing Stream (#842)
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 authored Nov 15, 2024
1 parent 69d02b5 commit 703ac9c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/native/http2_stream_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ static void s_on_stream_manager_shutdown_complete_callback(void *user_data) {
}

/* We're done with this wrapper, free it. */
JavaVM *jvm = binding->jvm;
s_destroy_manager_binding(binding, env);
aws_jni_release_thread_env(binding->jvm, env);
aws_jni_release_thread_env(jvm, env);
/********** JNI ENV RELEASE **********/
}

Expand Down Expand Up @@ -340,8 +341,9 @@ static void s_on_stream_acquired(struct aws_http_stream *stream, int error_code,
}
}
AWS_FATAL_ASSERT(!aws_jni_check_and_clear_exception(env));
JavaVM *jvm = callback_data->jvm;
s_cleanup_sm_acquire_stream_callback_data(callback_data, env);
aws_jni_release_thread_env(callback_data->jvm, env);
aws_jni_release_thread_env(jvm, env);
/********** JNI ENV RELEASE **********/
}

Expand Down
3 changes: 2 additions & 1 deletion src/native/http_request_response.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,9 @@ void aws_java_http_stream_on_stream_destroy_fn(void *user_data) {
return;
}
/* Native stream destroyed, release the binding. */
JavaVM *jvm = binding->jvm;
aws_http_stream_binding_release(env, binding);
aws_jni_release_thread_env(binding->jvm, env);
aws_jni_release_thread_env(jvm, env);
/********** JNI ENV RELEASE **********/
}

Expand Down

0 comments on commit 703ac9c

Please sign in to comment.