]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Move assignment to success (CID #1504462) (#5074)
authorJames Jones <jejones3141@gmail.com>
Tue, 20 Jun 2023 19:31:41 +0000 (14:31 -0500)
committerGitHub <noreply@github.com>
Tue, 20 Jun 2023 19:31:41 +0000 (15:31 -0400)
Coverity looks at control flow in xlat_purify_list() and judges that
success is guaranteed to be false by the time it's checked. We think
that moving the initialization before the unlang_xlat_push_node()
call, which passes it &success, will function the same while
reassuring coverity.

src/lib/unlang/xlat_purify.c

index 57c3d73199b271c3a3fb2ddd97c02a4fa24917ed..dafe3137e946cb3dc48d7da69b0dee230349d297 100644 (file)
@@ -142,8 +142,8 @@ int xlat_purify_list(xlat_exp_head_t *head, request_t *request)
                         *      evaluate the entire thing to purify it.
                         */
                        fr_assert(node->flags.pure);
-
                        fr_value_box_list_init(&list);
+                       success = false;
                        if (unlang_xlat_push_node(head, &success, &list, request, node) < 0) {
                                return -1;
                        }
@@ -151,9 +151,8 @@ int xlat_purify_list(xlat_exp_head_t *head, request_t *request)
                        /*
                         *      Hope to god it doesn't yield. :)
                         */
-                       success = false;
-                       (void) unlang_interpret_synchronous(NULL, request);
 
+                       (void) unlang_interpret_synchronous(NULL, request);
                        if (!success) return -1;
 
                        /*