]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
tmpl: Fix minor leak (#3416)
authorJorge Pereira <jpereira@users.noreply.github.com>
Fri, 1 May 2020 20:08:04 +0000 (17:08 -0300)
committerGitHub <noreply@github.com>
Fri, 1 May 2020 20:08:04 +0000 (15:08 -0500)
Let's release all allocated memory when something goes wrong.

src/lib/server/tmpl.c

index 0c5a95b4d577d0ce879860be3e877ea94977a15c..8996489a6dca7b20781206b1a67a22a879fba6fc 100644 (file)
@@ -1154,6 +1154,7 @@ ssize_t tmpl_afrom_str(TALLOC_CTX *ctx, vp_tmpl_t **out,
                if (slen > 0) {
                        if ((size_t) slen < inlen) {
                                fr_strerror_printf("Unexpected text after attribute name");
+                               talloc_free(vpt);
                                return -slen;
                        }
                        break;
@@ -2051,6 +2052,7 @@ ssize_t _tmpl_to_atype(TALLOC_CTX *ctx, void *out,
                talloc_free(tmp_ctx);
                if (ret < 0) {
                        RPEDEBUG("Failed copying data to output box");
+                       TALLOC_FREE(*vb_out);
                        return -1;
                }
                return 0;