Skip to content

Commit 109c841

Browse files
committed
fix memory leak in oidc_refresh_token_grant
free the parsed id_token that is returned; bump to 2.4.14.4rc5 Signed-off-by: Hans Zandbelt <[email protected]>
1 parent 3947b0b commit 109c841

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

ChangeLog

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
09/22/2023
22
- performance: store userinfo refresh interval in session to avoid parsing JSON on each request
3-
- bump to 2.4.14.4rc4
3+
- fix memory leak in oidc_refresh_token_grant: free the parsed id_token that is returned
4+
- bump to 2.4.14.4rc5
45

56
09/20/2023
67
- performance: skip re-validating cached provider metadata

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
AC_INIT([mod_auth_openidc],[2.4.14.4rc4],[[email protected]])
1+
AC_INIT([mod_auth_openidc],[2.4.14.4rc5],[[email protected]])
22

33
AC_SUBST(NAMEVER, AC_PACKAGE_TARNAME()-AC_PACKAGE_VERSION())
44

src/mod_auth_openidc.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,8 @@ static apr_byte_t oidc_refresh_token_grant(request_rec *r, oidc_cfg *c,
10771077
char *s_token_type = NULL;
10781078
char *s_access_token = NULL;
10791079
char *s_refresh_token = NULL;
1080+
oidc_jwt_t *id_token_jwt = NULL;
1081+
oidc_jose_error_t err;
10801082

10811083
/* refresh the tokens by calling the token endpoint */
10821084
if (oidc_proto_refresh_request(r, c, provider, refresh_token, &s_id_token,
@@ -1103,15 +1105,13 @@ static apr_byte_t oidc_refresh_token_grant(request_rec *r, oidc_cfg *c,
11031105

11041106
/* if we have a new id_token, store it in the session and update the session max lifetime if required */
11051107
if (s_id_token != NULL) {
1108+
11061109
/* only store the serialized representation when configured so */
11071110
if (c->store_id_token == TRUE)
11081111
oidc_session_set_idtoken(r, session, s_id_token);
11091112

1110-
oidc_jwt_t *id_token_jwt = NULL;
1111-
oidc_jose_error_t err;
11121113
if (oidc_jwt_parse(r->pool, s_id_token, &id_token_jwt, NULL, FALSE,
11131114
&err) == TRUE) {
1114-
11151115
/* store the claims payload in the id_token for later reference */
11161116
oidc_session_set_idtoken_claims(r, session,
11171117
id_token_jwt->payload.value.str);
@@ -1134,6 +1134,9 @@ static apr_byte_t oidc_refresh_token_grant(request_rec *r, oidc_cfg *c,
11341134
} else {
11351135
oidc_warn(r, "parsing of id_token failed");
11361136
}
1137+
1138+
if (id_token_jwt != NULL)
1139+
oidc_jwt_destroy(id_token_jwt);
11371140
}
11381141

11391142
return TRUE;

0 commit comments

Comments
 (0)