]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Ensure insert is always initialised to quiet clang scan
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 25 Apr 2025 16:25:59 +0000 (12:25 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 25 Apr 2025 16:25:59 +0000 (12:25 -0400)
src/lib/server/command.c

index 3f1e91a8480ae57ffea5c3c6e1e3fec92803c616..66b9b26cf82fd2b61cb2d4d7da715937d96243e2 100644 (file)
@@ -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;