]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
remove one more bstrsteal by reordering code
authorAlan T. DeKok <aland@freeradius.org>
Fri, 22 May 2020 16:06:46 +0000 (12:06 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sat, 23 May 2020 12:42:21 +0000 (08:42 -0400)
src/lib/unlang/xlat_builtin.c

index d3e0154207d3d74b5a44833320536eaa1280d792..0ae318eedf24f623502a60ee97a5b44ef1bf5342 100644 (file)
@@ -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);
        }