From: Jorge Pereira Date: Fri, 1 May 2020 20:08:04 +0000 (-0300) Subject: tmpl: Fix minor leak (#3416) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e30fd6733c64084fbdfdd3dd890b6dff2c8f380;p=thirdparty%2Ffreeradius-server.git tmpl: Fix minor leak (#3416) Let's release all allocated memory when something goes wrong. --- diff --git a/src/lib/server/tmpl.c b/src/lib/server/tmpl.c index 0c5a95b4d57..8996489a6dc 100644 --- a/src/lib/server/tmpl.c +++ b/src/lib/server/tmpl.c @@ -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;