summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2012-11-26 11:50:56 +0100
committerThomas Graf <tgraf@suug.ch>2012-11-26 11:50:56 +0100
commit4149154c226a47f67f5ad32b5532831534a755e9 (patch)
treecc1fa9ffa210bb7907503e5660d5e1135197a7c8
parent05a6723eb5d63d9d1a3eb025b8f20dd6af2bde35 (diff)
downloadlibnl-4149154c226a47f67f5ad32b5532831534a755e9.tar.gz
cache: only continue iterating over co_groups if it is available
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>
-rw-r--r--lib/cache.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/cache.c b/lib/cache.c
index 415e471..8ba3d5b 100644
--- a/lib/cache.c
+++ b/lib/cache.c
@@ -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));