Skip to content

Commit ae407ce

Browse files
Release GetHandshakeStatus JNI local
Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com>
1 parent d3dfc20 commit ae407ce

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

src/native/libs/System.Security.Cryptography.Native.Android/pal_sslstream.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,21 @@ ARGS_NON_NULL_ALL static PAL_SSLStreamStatus DoUnwrap(JNIEnv* env, SSLStream* ss
3838

3939
ARGS_NON_NULL_ALL static int GetHandshakeStatus(JNIEnv* env, SSLStream* sslStream)
4040
{
41+
int ret = -1;
42+
INIT_LOCALS(loc, status);
43+
4144
// int handshakeStatus = sslEngine.getHandshakeStatus().ordinal();
42-
jobject status = (*env)->CallObjectMethod(env, sslStream->sslEngine, g_SSLEngineGetHandshakeStatus);
43-
if (CheckJNIExceptions(env) || status == NULL)
44-
return -1;
45+
loc[status] = (*env)->CallObjectMethod(env, sslStream->sslEngine, g_SSLEngineGetHandshakeStatus);
46+
ON_EXCEPTION_PRINT_AND_GOTO(cleanup);
47+
if (loc[status] == NULL)
48+
goto cleanup;
4549

46-
int handshakeStatus = GetEnumAsInt(env, status);
47-
if (CheckJNIExceptions(env))
48-
return -1;
50+
ret = GetEnumAsInt(env, loc[status]);
51+
ON_EXCEPTION_PRINT_AND_GOTO(cleanup);
4952

50-
return handshakeStatus;
53+
cleanup:
54+
RELEASE_LOCALS(loc, env);
55+
return ret;
5156
}
5257

5358
static bool IsHandshaking(int handshakeStatus)

0 commit comments

Comments
 (0)