From fb2bfdee41dcdfc7a4318de537ce79d30f2bf6df Mon Sep 17 00:00:00 2001 From: Arran Cudbard-Bell Date: Fri, 25 Apr 2025 12:25:59 -0400 Subject: [PATCH] Ensure insert is always initialised to quiet clang scan --- src/lib/server/command.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib/server/command.c b/src/lib/server/command.c index 3f1e91a848..66b9b26cf8 100644 --- a/src/lib/server/command.c +++ b/src/lib/server/command.c @@ -101,13 +101,21 @@ static fr_cmd_t *fr_command_find(fr_cmd_t **head, char const *name, fr_cmd_t *** { fr_cmd_t *cmd, **where = head; - if (!head || !name) return NULL; + if (!head || !name) { + if (insert) *insert = head; + return NULL; + } if (!*head) { if (insert) *insert = head; return NULL; } + /* + * Ensure if we exit int he loop insert is initialised + */ + if (insert) *insert = NULL; + for (cmd = *head; cmd != NULL; cmd = cmd->next) { int status; -- 2.47.2