Remove redundant NULL pointer checks before free functions
found by nullfree.cocci

Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
---
 lib/port/rte_port_source_sink.c | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/lib/port/rte_port_source_sink.c b/lib/port/rte_port_source_sink.c
index 68575c98338d..79042d13ff66 100644
--- a/lib/port/rte_port_source_sink.c
+++ b/lib/port/rte_port_source_sink.c
@@ -163,14 +163,10 @@ pcap_source_load(struct rte_port_source *port,
        return 0;
 
 error_exit:
-       if (pkt_len_aligns)
-               rte_free(pkt_len_aligns);
-       if (port->pkt_len)
-               rte_free(port->pkt_len);
-       if (port->pkts)
-               rte_free(port->pkts);
-       if (port->pkt_buff)
-               rte_free(port->pkt_buff);
+       rte_free(pkt_len_aligns);
+       rte_free(port->pkt_len);
+       rte_free(port->pkts);
+       rte_free(port->pkt_buff);
 
        return -1;
 }
@@ -242,12 +238,9 @@ rte_port_source_free(void *port)
        if (p == NULL)
                return 0;
 
-       if (p->pkt_len)
-               rte_free(p->pkt_len);
-       if (p->pkts)
-               rte_free(p->pkts);
-       if (p->pkt_buff)
-               rte_free(p->pkt_buff);
+       rte_free(p->pkt_len);
+       rte_free(p->pkts);
+       rte_free(p->pkt_buff);
 
        rte_free(p);
 
-- 
2.30.2

Reply via email to