GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Delete local references as soon as possible in callbacks (#996) · netty/netty-tcnative@990751e

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • openssl-dynamic/src/main/c
    • cert_compress.c
    • sslcontext.c
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎openssl-dynamic/src/main/c/cert_compress.c‎

Copy file name to clipboardExpand all lines: openssl-dynamic/src/main/c/cert_compress.c
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ static int compress(jobject compression_algorithm, jmethodID compress_method, SS
4040
jbyteArray resultArray = (*e)->CallObjectMethod(e, compression_algorithm, compress_method,
4141
P2J(ssl), inputArray);
4242

43+
NETTY_JNI_UTIL_DELETE_LOCAL(e, inputArray);
44+
4345
if ((*e)->ExceptionCheck(e) != JNI_FALSE) {
4446
(*e)->ExceptionClear(e);
4547
return 0; // Exception while calling into Java
@@ -88,6 +90,8 @@ static int decompress(jobject compression_algorithm, jmethodID decompress_method
8890
jbyteArray resultArray = (*e)->CallObjectMethod(e, compression_algorithm, decompress_method,
8991
P2J(ssl), uncompressed_len, inputArray);
9092

93+
NETTY_JNI_UTIL_DELETE_LOCAL(e, inputArray);
94+
9195
if ((*e)->ExceptionCheck(e) != JNI_FALSE) {
9296
(*e)->ExceptionClear(e);
9397
return 0; // Exception while calling into Java
Collapse file

‎openssl-dynamic/src/main/c/sslcontext.c‎

Copy file name to clipboardExpand all lines: openssl-dynamic/src/main/c/sslcontext.c
+14Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,6 +1631,8 @@ static int SSL_cert_verify(X509_STORE_CTX *ctx, void *arg) {
16311631

16321632
result = (*e)->CallIntMethod(e, c->verifier, c->verifier_method, P2J(ssl), array, authMethodString);
16331633

1634+
NETTY_JNI_UTIL_DELETE_LOCAL(e, authMethodString);
1635+
16341636
if ((*e)->ExceptionCheck(e)) {
16351637
// We always need to set the error as stated in the SSL_CTX_set_cert_verify_callback manpage, so set the result
16361638
// to the correct value.
@@ -1761,6 +1763,8 @@ enum ssl_verify_result_t tcn_SSL_cert_custom_verify(SSL* ssl, uint8_t *out_alert
17611763
// Execute the java callback
17621764
result = (*e)->CallIntMethod(e, state->ctx->verifier, state->ctx->verifier_method, P2J(ssl), array, authMethodString);
17631765

1766+
NETTY_JNI_UTIL_DELETE_LOCAL(e, authMethodString);
1767+
17641768
if ((*e)->ExceptionCheck(e) == JNI_TRUE) {
17651769
result = X509_V_ERR_UNSPECIFIED;
17661770
goto complete;
@@ -1985,6 +1989,9 @@ static int cert_requested(SSL* ssl, X509** x509Out, EVP_PKEY** pkeyOut) {
19851989
(*e)->CallVoidMethod(e, c->cert_requested_callback, c->cert_requested_callback_method,
19861990
P2J(ssl), P2J(x509Out), P2J(pkeyOut), types, issuers);
19871991

1992+
NETTY_JNI_UTIL_DELETE_LOCAL(e, types);
1993+
NETTY_JNI_UTIL_DELETE_LOCAL(e, issuers);
1994+
19881995
// Check if java threw an exception and if so signal back that we should not continue with the handshake.
19891996
if ((*e)->ExceptionCheck(e)) {
19901997
return -1;
@@ -2113,6 +2120,9 @@ static int certificate_cb(SSL* ssl, void* arg) {
21132120
(*e)->CallVoidMethod(e, state->ctx->certificate_callback, state->ctx->certificate_callback_method,
21142121
P2J(ssl), types, issuers);
21152122

2123+
NETTY_JNI_UTIL_DELETE_LOCAL(e, types);
2124+
NETTY_JNI_UTIL_DELETE_LOCAL(e, issuers);
2125+
21162126
// Check if java threw an exception and if so signal back that we should not continue with the handshake.
21172127
if ((*e)->ExceptionCheck(e) != JNI_TRUE) {
21182128
// Everything good...
@@ -2509,6 +2519,7 @@ static SSL_SESSION* tcn_get_session_cb(SSL *ssl, unsigned char *session_id, int
25092519
(*e)->SetByteArrayRegion(e, bArray, 0, len, (jbyte*) session_id);
25102520

25112521
result = (*e)->CallLongMethod(e, c->ssl_session_cache, c->ssl_session_cache_get_method, P2J(ssl), bArray);
2522+
NETTY_JNI_UTIL_DELETE_LOCAL(e, bArray);
25122523

25132524
if ((*e)->ExceptionCheck(e)) {
25142525
return NULL;
@@ -2676,6 +2687,9 @@ static void keylog_cb(const SSL* ssl, const char *line) {
26762687
// Execute the java callback
26772688
(*e)->CallVoidMethod(e, state->ctx->keylog_callback, state->ctx->keylog_callback_method,
26782689
P2J(ssl), outputLine);
2690+
2691+
NETTY_JNI_UTIL_DELETE_LOCAL(e, outputLine);
2692+
26792693
// Clear the exception if any was thrown as otherwise we might corrupt the JNI state
26802694
if ((*e)->ExceptionCheck(e) == JNI_TRUE) {
26812695
(*e)->ExceptionClear(e);

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.