From: Jorge Pereira Date: Wed, 18 Aug 2021 13:36:45 +0000 (-0300) Subject: sqlcounter: Fix wrong memory free (#4192) X-Git-Tag: release_3_0_24~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1876b2783016b22e13bceebd3bec8e81276c3a4d;p=thirdparty%2Ffreeradius-server.git sqlcounter: Fix wrong memory free (#4192) --- diff --git a/src/modules/rlm_sqlcounter/rlm_sqlcounter.c b/src/modules/rlm_sqlcounter/rlm_sqlcounter.c index 47ebfe0b3a..e64e309617 100644 --- a/src/modules/rlm_sqlcounter/rlm_sqlcounter.c +++ b/src/modules/rlm_sqlcounter/rlm_sqlcounter.c @@ -534,8 +534,8 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authorize(void *instance, REQUEST *reque } /* - * Look for the key. User-Name is special. It means - * The REAL username, after stripping. + * Look for the key. User-Name is special. It means + * The REAL username, after stripping. */ if ((inst->key_attr->vendor == 0) && (inst->key_attr->attr == PW_USER_NAME)) { key_vp = request->username; @@ -548,7 +548,7 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authorize(void *instance, REQUEST *reque } /* - * Look for the check item + * Look for the check item */ if ((da = dict_attrbyname(inst->limit_name)) == NULL) { return rcode; @@ -580,7 +580,6 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authorize(void *instance, REQUEST *reque if (radius_axlat(&expanded, request, query, NULL, NULL) < 0) { return RLM_MODULE_FAIL; } - talloc_free(expanded); if (sscanf(expanded, "%" PRIu64, &counter) != 1) { RDEBUG2("No integer found in result string \"%s\". May be first session, setting counter to 0", @@ -588,6 +587,8 @@ static rlm_rcode_t CC_HINT(nonnull) mod_authorize(void *instance, REQUEST *reque counter = 0; } + talloc_free(expanded); + /* * Check if check item > counter */