]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Use taloc_typed_strdup when xlat_eval returns no values
authorNick Porter <nick@portercomputing.co.uk>
Thu, 2 Nov 2023 11:17:54 +0000 (11:17 +0000)
committerNick Porter <nick@portercomputing.co.uk>
Thu, 2 Nov 2023 11:17:54 +0000 (11:17 +0000)
Otherwise using the resulting string in
fr_pair_value_bstrdup_buffer_shallow() or other functions which check
the talloc type will fail.

src/lib/unlang/xlat_eval.c

index 77d4805a4b5e4a3924ba0ddc9481f0657376e115..453c6d970f306c21f4c8c92579be8efeebb82d58 100644 (file)
@@ -1397,7 +1397,7 @@ static ssize_t xlat_eval_sync(TALLOC_CTX *ctx, char **out, request_t *request, x
                        goto error;
                }
        } else {
-               str = talloc_strdup(ctx, "");
+               str = talloc_typed_strdup(ctx, "");
        }
        talloc_free(pool);      /* Memory should be in new ctx */