From: Alan T. DeKok Date: Sun, 19 Nov 2023 14:15:19 +0000 (-0500) Subject: clean up and check for subst==NULL X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91df758e3ac820042348ed47235c5a009ba96960;p=thirdparty%2Ffreeradius-server.git clean up and check for subst==NULL --- diff --git a/src/lib/util/print.c b/src/lib/util/print.c index b8041fc313d..29e586955fe 100644 --- a/src/lib/util/print.c +++ b/src/lib/util/print.c @@ -685,17 +685,13 @@ static char *fr_vasprintf_internal(TALLOC_CTX *ctx, char const *fmt, va_list ap, } else if (in) { fr_value_box_aprint(NULL, &subst, in, e_rules); - if (!subst) { - talloc_free(out); - va_end(ap_p); - va_end(ap_q); - return NULL; - } } else { subst = talloc_typed_strdup(NULL, "(null)"); } do_splice: + if (!subst) goto oom; + p++; /* @@ -719,15 +715,15 @@ static char *fr_vasprintf_internal(TALLOC_CTX *ctx, char const *fmt, va_list ap, out = out_tmp; out_tmp = talloc_strdup_append_buffer(out, subst); - TALLOC_FREE(subst); if (!out_tmp) goto oom; + TALLOC_FREE(subst); out = out_tmp; va_end(ap_p); /* one time use only */ } else { out_tmp = talloc_strdup_append_buffer(out, subst); - TALLOC_FREE(subst); if (!out_tmp) goto oom; + TALLOC_FREE(subst); out = out_tmp; } @@ -743,8 +739,6 @@ static char *fr_vasprintf_internal(TALLOC_CTX *ctx, char const *fmt, va_list ap, if (!in) { subst = talloc_strdup(NULL, "(null)"); - if (!subst) goto oom; - goto do_splice; }