OpenIDC / mod_auth_openidc

OpenID Certified™ OpenID Connect Relying Party implementation for Apache HTTP Server 2.x
Apache License 2.0
990 stars 327 forks source link

memory leak when verifying claims with pcre2 #902

Closed smanolache closed 2 years ago

smanolache commented 2 years ago

Hello,

I think there's a memory leak in authz.c, oidc_authz_match_expression. In the 'else if' branch there's a loop in which oidc_pcre_exec is called. This function allocates pcre->match_data. This match_data is indeed freed, but only once, outside the loop. So if the loop is executed several times, match_data is allocated several times but only the last allocation is freed.

I propose the attached patch. oidc_pcre.txt