From: Alan T. DeKok Date: Thu, 20 Jan 2022 14:09:54 +0000 (-0500) Subject: initialize the output box only as the last step before returning X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e42b6b9e3d0d22259096ce40f8afb1735ee0200;p=thirdparty%2Ffreeradius-server.git initialize the output box only as the last step before returning --- diff --git a/src/lib/util/calc.c b/src/lib/util/calc.c index 1eb08ee2e2..62aaa1fa35 100644 --- a/src/lib/util/calc.c +++ b/src/lib/util/calc.c @@ -1743,17 +1743,15 @@ int fr_value_calc_binary_op(TALLOC_CTX *ctx, fr_value_box_t *dst, fr_type_t hint goto done; } - fr_value_box_init(dst, FR_TYPE_BOOL, NULL, false); - - /* - * Try to "up-cast" the types. This is - * so that we can take (for example) - * uint8 < uint16, and have it make - * sense. uint16. - * - * There must be only one entry per [a,b] - * pairing. That way we're sure that [a,b]==[b,a] - */ + /* + * Try to "up-cast" the types. This is + * so that we can take (for example) + * uint8 < uint16, and have it make + * sense. uint16. + * + * There must be only one entry per [a,b] + * pairing. That way we're sure that [a,b]==[b,a] + */ if (a->type != b->type) { hint = upcast_cmp[a->type][b->type]; if (hint == FR_TYPE_NULL) { @@ -1788,6 +1786,7 @@ int fr_value_calc_binary_op(TALLOC_CTX *ctx, fr_value_box_t *dst, fr_type_t hint rcode = fr_value_box_cmp_op(op, a, b); if (rcode < 0) goto done; + fr_value_box_init(dst, FR_TYPE_BOOL, NULL, false); dst->vb_bool = (rcode > 0); break;