]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
sqlcounter: Fix wrong memory free (#4192)
authorJorge Pereira <jpereira@users.noreply.github.com>
Wed, 18 Aug 2021 13:36:45 +0000 (10:36 -0300)
committerGitHub <noreply@github.com>
Wed, 18 Aug 2021 13:36:45 +0000 (08:36 -0500)
src/modules/rlm_sqlcounter/rlm_sqlcounter.c

index 47ebfe0b3a342df5ee8fb4f22f90f20984e1e99f..e64e309617ca89083f1b3cffc9569cdf3664f829 100644 (file)
@@ -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
         */