From df73476ab2ef3834afabcc3e44c33b1557d2754e Mon Sep 17 00:00:00 2001 From: sadilchamishka Date: Sun, 5 Jan 2025 09:10:54 +0530 Subject: [PATCH] Fix memory leak of the callChoreo access token request helper function --- .../auth/functions/choreo/CallChoreoFunctionImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/org.wso2.carbon.identity.conditional.auth.functions.choreo/src/main/java/org/wso2/carbon/identity/conditional/auth/functions/choreo/CallChoreoFunctionImpl.java b/components/org.wso2.carbon.identity.conditional.auth.functions.choreo/src/main/java/org/wso2/carbon/identity/conditional/auth/functions/choreo/CallChoreoFunctionImpl.java index aeb3e1fe..ff4e4fd0 100644 --- a/components/org.wso2.carbon.identity.conditional.auth.functions.choreo/src/main/java/org/wso2/carbon/identity/conditional/auth/functions/choreo/CallChoreoFunctionImpl.java +++ b/components/org.wso2.carbon.identity.conditional.auth.functions.choreo/src/main/java/org/wso2/carbon/identity/conditional/auth/functions/choreo/CallChoreoFunctionImpl.java @@ -343,7 +343,8 @@ public void completed(HttpResponse httpResponse) { boolean isFailure = false; try { - LOG.debug("Access token response received."); + LOG.info("Access token response received. Session data key: " + + authenticationContext.getContextIdentifier()); int responseCode = httpResponse.getStatusLine().getStatusCode(); if (responseCode == HTTP_STATUS_OK) { Type responseBodyType = new TypeToken>() { }.getType(); @@ -372,6 +373,8 @@ public void completed(HttpResponse httpResponse) { LOG.error("Error occurred while handling the token response from Choreo. Session data key: " + authenticationContext.getContextIdentifier(), e); isFailure = true; + } finally { + EntityUtils.consumeQuietly(httpResponse.getEntity()); } if (isFailure) {