From 856b0c32606a8fb0de3010118881d4b16e66e9e8 Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Mon, 9 Oct 2017 12:27:52 +0200 Subject: [PATCH] Fix bug #52189: list add and remove bug in Apply patch from xuyao hong --- src/apps/lwiperf/lwiperf.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/apps/lwiperf/lwiperf.c b/src/apps/lwiperf/lwiperf.c index 2a5e350a..0304957b 100644 --- a/src/apps/lwiperf/lwiperf.c +++ b/src/apps/lwiperf/lwiperf.c @@ -167,11 +167,8 @@ static void lwiperf_tcp_err(void *arg, err_t err); static void lwiperf_list_add(lwiperf_state_base_t *item) { - if (lwiperf_all_connections == NULL) { - lwiperf_all_connections = item; - } else { - item = lwiperf_all_connections; - } + item->next = lwiperf_all_connections; + lwiperf_all_connections = item; } /** Remove an iperf session from the 'active' list */ @@ -185,7 +182,7 @@ lwiperf_list_remove(lwiperf_state_base_t *item) if (prev == NULL) { lwiperf_all_connections = iter->next; } else { - prev->next = item; + prev->next = iter->next; } /* @debug: ensure this item is listed only once */ for (iter = iter->next; iter != NULL; iter = iter->next) {