]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
free tag ctx, too
authorAlan T. DeKok <aland@freeradius.org>
Sun, 4 Feb 2024 15:46:41 +0000 (10:46 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 4 Feb 2024 15:46:41 +0000 (10:46 -0500)
src/protocols/radius/decode.c

index d54e6037468403969155a450fc1ad09c431948d4..5489bb27a6c2ae8ee8737b7adf72bf7908986e55 100644 (file)
@@ -2092,8 +2092,10 @@ ssize_t fr_radius_decode_foreign(TALLOC_CTX *ctx, fr_pair_list_t *out,
        while (attr < end) {
                slen = fr_radius_decode_pair(ctx, out, attr, (end - attr), &decode_ctx);
                if (slen < 0) {
+               fail:
                        talloc_free(decode_ctx.tmp_ctx);
-                       return slen - (attr - data);
+                       talloc_free(decode_ctx.tags);
+                       return slen;
                }
 
                /*
@@ -2101,8 +2103,7 @@ ssize_t fr_radius_decode_foreign(TALLOC_CTX *ctx, fr_pair_list_t *out,
                 *      all kinds of bad things happen.
                 */
                 if (!fr_cond_assert(slen <= (end - attr))) {
-                       talloc_free(decode_ctx.tmp_ctx);
-                        return -slen - (attr - data);
+                        goto fail;
                 }
 
                attr += slen;
@@ -2110,6 +2111,7 @@ ssize_t fr_radius_decode_foreign(TALLOC_CTX *ctx, fr_pair_list_t *out,
        }
 
        talloc_free(decode_ctx.tmp_ctx);
+       talloc_free(decode_ctx.tags);
        return data_len;
 }