From 70b9526834e8aae2b78893dfcde688edb2aceea3 Mon Sep 17 00:00:00 2001 From: Thomas Bernard Date: Sun, 7 Jun 2020 19:58:48 +0200 Subject: [PATCH] remove unecessary if in flush_nft_cache() --- miniupnpd/netfilter_nft/nftnlrdr_misc.c | 26 ++++++++++++------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/miniupnpd/netfilter_nft/nftnlrdr_misc.c b/miniupnpd/netfilter_nft/nftnlrdr_misc.c index 68d23c2..9afbeec 100644 --- a/miniupnpd/netfilter_nft/nftnlrdr_misc.c +++ b/miniupnpd/netfilter_nft/nftnlrdr_misc.c @@ -608,21 +608,19 @@ flush_nft_cache(struct rule_list *head) rule_t *p1, *p2; p1 = LIST_FIRST(head); - if (p1 != NULL) { - while (p1 != NULL) { - p2 = (rule_t *)LIST_NEXT(p1, entry); - if (p1->desc != NULL) { - free(p1->desc); - } - if (p1->table != NULL) { - free(p1->table); - } - if (p1->chain != NULL) { - free(p1->chain); - } - free(p1); - p1 = p2; + while (p1 != NULL) { + p2 = (rule_t *)LIST_NEXT(p1, entry); + if (p1->desc != NULL) { + free(p1->desc); } + if (p1->table != NULL) { + free(p1->table); + } + if (p1->chain != NULL) { + free(p1->chain); + } + free(p1); + p1 = p2; } LIST_INIT(head); }