[PATCH v2 04/83] eal/windows: remove unnecessary NULL checks before free
Stephen Hemminger
stephen at networkplumber.org
Mon Jan 24 18:46:00 CET 2022
Calling free/rte_free/rte_mempool_free,... with NULL pointer
is allowed; so remove unnecessary NULL checks.
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
lib/eal/windows/eal_alarm.c | 3 +--
lib/eal/windows/eal_memory.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/lib/eal/windows/eal_alarm.c b/lib/eal/windows/eal_alarm.c
index 103c1f909da3..51fe752c16d4 100644
--- a/lib/eal/windows/eal_alarm.c
+++ b/lib/eal/windows/eal_alarm.c
@@ -162,8 +162,7 @@ rte_eal_alarm_set(uint64_t us, rte_eal_alarm_callback cb_fn, void *cb_arg)
fail:
if (timer != NULL)
CloseHandle(timer);
- if (ap != NULL)
- free(ap);
+ free(ap);
exit:
rte_eal_trace_alarm_set(us, cb_fn, cb_arg, ret);
diff --git a/lib/eal/windows/eal_memory.c b/lib/eal/windows/eal_memory.c
index 2fd37d97085e..215d768e2c57 100644
--- a/lib/eal/windows/eal_memory.c
+++ b/lib/eal/windows/eal_memory.c
@@ -190,8 +190,7 @@ eal_mem_virt2iova_init(void)
ret = 0;
exit:
- if (detail != NULL)
- free(detail);
+ free(detail);
if (list != INVALID_HANDLE_VALUE)
SetupDiDestroyDeviceInfoList(list);
--
2.30.2
More information about the dev
mailing list