]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
clean up tags on fail, too
authorAlan T. DeKok <aland@freeradius.org>
Tue, 26 Jan 2021 11:45:27 +0000 (06:45 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 26 Jan 2021 11:45:37 +0000 (06:45 -0500)
src/protocols/radius/base.c

index 2aae250278d3bbfe83283ba5b914784bc574d0fd..11cbf8d2b3b4e75e33c57d4f76242ffa2f21f559 100644 (file)
@@ -1026,7 +1026,9 @@ ssize_t   fr_radius_decode(TALLOC_CTX *ctx, uint8_t const *packet, size_t packet_l
        while (attr < end) {
                slen = fr_radius_decode_pair(ctx, cursor, dict_radius, attr, (end - attr), &packet_ctx);
                if (slen < 0) {
+               fail:
                        talloc_free(packet_ctx.tmp_ctx);
+                       talloc_free(packet_ctx.tags);
                        return slen;
                }
 
@@ -1035,8 +1037,7 @@ ssize_t   fr_radius_decode(TALLOC_CTX *ctx, uint8_t const *packet, size_t packet_l
                 *      all kinds of bad things happen.
                 */
                 if (!fr_cond_assert(slen <= (end - attr))) {
-                        talloc_free(packet_ctx.tmp_ctx);
-                        return -1;
+                        goto fail;
                 }
 
                attr += slen;