]> granicus.if.org Git - libnl/commitdiff
cache: only continue iterating over co_groups if it is available
authorThomas Graf <tgraf@suug.ch>
Mon, 26 Nov 2012 10:50:56 +0000 (11:50 +0100)
committerThomas Graf <tgraf@suug.ch>
Mon, 26 Nov 2012 10:50:56 +0000 (11:50 +0100)
A co_groups == NULL must enter the loop to trigger the initial
fill of the cache but may never bump the grp pointer as doing
so prevents the loop from being escaped correctly.

Signed-off-by: Thomas Graf <tgraf@suug.ch>
lib/cache.c

index 415e4714723f9bea55e548b017a8091499c93458..8ba3d5bf7761918dbf9e1eaa08d9ccfd9229a031 100644 (file)
@@ -829,7 +829,9 @@ restart:
                        goto restart;
                else if (err < 0)
                        goto errout;
-               grp++;
+
+               if (grp)
+                       grp++;
        } while (grp && grp->ag_group &&
                (cache->c_flags & NL_CACHE_AF_ITER));
 
@@ -935,7 +937,8 @@ restart:
                } else if (err < 0)
                        break;
 
-               grp++;
+               if (grp)
+                       grp++;
        } while (grp && grp->ag_group &&
                        (cache->c_flags & NL_CACHE_AF_ITER));