From 9e0fa805902520a69060395d86c66528a2822dd7 Mon Sep 17 00:00:00 2001 From: Nick Porter Date: Mon, 4 Sep 2023 16:02:18 +0100 Subject: [PATCH] to_cast is not always talloced --- src/lib/redis/redis.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/redis/redis.c b/src/lib/redis/redis.c index 99ad53042dd04..c19210eaec7ae 100644 --- a/src/lib/redis/redis.c +++ b/src/lib/redis/redis.c @@ -281,7 +281,8 @@ int fr_redis_reply_to_value_box(TALLOC_CTX *ctx, fr_value_box_t *out, redisReply if (shallow) { fr_value_box_bstrndup_shallow(to_cast, NULL, reply->str, reply->len, true); } else { - if (fr_value_box_bstrndup(to_cast, to_cast, NULL, reply->str, reply->len, true) < 0) return -1; + if (fr_value_box_bstrndup(to_cast->talloced ? to_cast : ctx, to_cast, NULL, + reply->str, reply->len, true) < 0) return -1; } break;