]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Be more graceful if caller passes us a NULL ptr
authorAlan T. DeKok <aland@freeradius.org>
Thu, 29 Sep 2011 09:26:03 +0000 (11:26 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 29 Sep 2011 09:28:53 +0000 (11:28 +0200)
src/main/conffile.c

index 1e77b1ab0554c3528c3b0c721d10f9947d589473..4e159fde8939aa9b353294e284bafc7aca7f3b4d 100644 (file)
@@ -2016,6 +2016,8 @@ CONF_PAIR *cf_pair_find_next(const CONF_SECTION *cs,
 {
        CONF_ITEM       *ci;
 
+       if (!cs) return NULL;
+
        /*
         * If pair is NULL this must be a first time run
         * Find the pair with correct name
@@ -2144,6 +2146,8 @@ CONF_SECTION *cf_subsection_find_next(CONF_SECTION *section,
 {
        CONF_ITEM       *ci;
 
+       if (!section) return NULL;
+
        /*
         * If subsection is NULL this must be a first time run
         * Find the subsection with correct name
@@ -2177,6 +2181,8 @@ CONF_SECTION *cf_section_find_next(CONF_SECTION *section,
                                   CONF_SECTION *subsection,
                                   const char *name1)
 {
+       if (!section) return NULL;
+
        if (!section->item.parent) return NULL;
 
        return cf_subsection_find_next(section->item.parent, subsection, name1);
@@ -2188,6 +2194,8 @@ CONF_SECTION *cf_section_find_next(CONF_SECTION *section,
 
 CONF_ITEM *cf_item_find_next(CONF_SECTION *section, CONF_ITEM *item)
 {
+       if (!section) return NULL;
+
        /*
         * If item is NULL this must be a first time run
         * Return the first item