Proper checks on group-type sections
authorAlan T. DeKok <aland@freeradius.org>
Wed, 17 Jul 2013 09:45:04 +0000 (11:45 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 17 Jul 2013 09:45:27 +0000 (11:45 +0200)
This should really be a flag rather than a compile-time check

src/main/modcall.c

index f430283..2dd29c9 100644 (file)
@@ -2232,11 +2232,15 @@ void add_to_modcallable(modcallable **parent, modcallable *this,
 void modcallable_free(modcallable **pc)
 {
        modcallable *c, *loop, *next;
+
+       if (!pc || !*pc) return;
+
        c = *pc;
-       if (c->type != MOD_SINGLE) {
+
+       if ((c->type > MOD_SINGLE) && (c->type <= MOD_POLICY)) {
                modgroup *g = mod_callabletogroup(c);
 
-               if (g->children) for(loop = g->children;
+               if (g->children) for (loop = g->children;
                    loop ;
                    loop = next) {
                        next = loop->next;