From: Alan T. DeKok Date: Fri, 22 May 2020 16:06:46 +0000 (-0400) Subject: remove one more bstrsteal by reordering code X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=261d366c19ac8bc28777d463a5cc437c445cb426;p=thirdparty%2Ffreeradius-server.git remove one more bstrsteal by reordering code --- diff --git a/src/lib/unlang/xlat_builtin.c b/src/lib/unlang/xlat_builtin.c index d3e0154207d..0ae318eedf2 100644 --- a/src/lib/unlang/xlat_builtin.c +++ b/src/lib/unlang/xlat_builtin.c @@ -2190,7 +2190,6 @@ static xlat_action_t xlat_func_pairs(TALLOC_CTX *ctx, fr_cursor_t *out, { vp_tmpl_t *vpt = NULL; fr_cursor_t cursor; - char *buff; fr_value_box_t *vb; /* @@ -2218,13 +2217,16 @@ static xlat_action_t xlat_func_pairs(TALLOC_CTX *ctx, fr_cursor_t *out, vp; vp = fr_cursor_next(&cursor)) { fr_token_t op = vp->op; + char *buff; + + MEM(vb = fr_value_box_alloc(ctx, FR_TYPE_STRING, NULL, false)); vp->op = T_OP_EQ; - buff = fr_pair_asprint(ctx, vp, '"'); + buff = fr_pair_asprint(vb, vp, '"'); vp->op = op; - MEM(vb = fr_value_box_alloc(ctx, FR_TYPE_STRING, NULL, false)); - fr_value_box_bstrsteal(vb, vb, NULL, buff, false); + vb->vb_strvalue = buff; + vb->vb_length = talloc_array_length(buff) - 1; fr_cursor_append(out, vb); }