This fixes possible problems when trie_firstleaf() returns NULL
to trie_leafindex().

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Stephen Hemminger 2008-02-11 21:12:49 -08:00 коммит произвёл David S. Miller
Родитель e4f8b5d4ed
Коммит ec28cf738d
1 изменённых файлов: 2 добавлений и 4 удалений

Просмотреть файл

@ -1762,11 +1762,9 @@ static struct leaf *trie_leafindex(struct trie *t, int index)
{
struct leaf *l = trie_firstleaf(t);
while (index-- > 0) {
while (l && index-- > 0)
l = trie_nextleaf(l);
if (!l)
break;
}
return l;
}