From: Alan T. DeKok Date: Sun, 4 Feb 2024 15:46:41 +0000 (-0500) Subject: free tag ctx, too X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea8b808f09c33e1c750bb8d75f9dc90280fc9723;p=thirdparty%2Ffreeradius-server.git free tag ctx, too --- diff --git a/src/protocols/radius/decode.c b/src/protocols/radius/decode.c index d54e6037468..5489bb27a6c 100644 --- a/src/protocols/radius/decode.c +++ b/src/protocols/radius/decode.c @@ -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; }