Initialize child count in modcall_recurse
authorNikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
Thu, 29 Jan 2015 12:08:12 +0000 (14:08 +0200)
committerNikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
Fri, 30 Jan 2015 16:16:32 +0000 (18:16 +0200)
Initialize child count in modcall_recurse to explicitly handle the case of no
children, making the code at least slightly easier to read, if not actually
fixing an issue.

This fixes the following Coverity error:

Error: UNINIT (CWE-457):
freeradius-server-2.2.6/src/main/modcall.c:691: var_decl: Declaring variable "count" without initializer.
freeradius-server-2.2.6/src/main/modcall.c:727: uninit_use: Using uninitialized value "count".

src/main/modcall.c

index 7e96562..d9cebe9 100644 (file)
@@ -687,7 +687,7 @@ redo:
 
        if ((c->type == MOD_LOAD_BALANCE) ||
            (c->type == MOD_REDUNDANT_LOAD_BALANCE)) {
-               int count;
+               int count = 0;
                modcallable *this, *found;
                modgroup *g;