Signed-off-by: Vitezslav Samel <vitezslav(a)samel.cz>
---
src/ifstats.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/src/ifstats.c b/src/ifstats.c
index 479c243..2b009e5 100644
--- a/src/ifstats.c
+++ b/src/ifstats.c
@@ -231,20 +231,14 @@ static struct iflist *positionptr(struct iflist *iflist, const int
ifindex)
static void destroyiflist(struct iflist *list)
{
- struct iflist *ctmp;
- struct iflist *ptmp;
+ struct iflist *ptmp = list;
+
+ while (ptmp != NULL) {
+ struct iflist *ctmp = ptmp->next_entry;
- if (list != NULL) {
- ptmp = list;
- ctmp = ptmp->next_entry;
-
- do {
- rate_destroy(&ptmp->rate);
- free(ptmp);
- ptmp = ctmp;
- if (ctmp != NULL)
- ctmp = ctmp->next_entry;
- } while (ptmp != NULL);
+ rate_destroy(&ptmp->rate);
+ free(ptmp);
+ ptmp = ctmp;
}
}
--
1.9.1