apps/iperf: cleanup timer when test is terminated
authorEunBong Song <eunb.song@samsung.com>
Thu, 27 Apr 2017 05:04:31 +0000 (14:04 +0900)
committerHeesub Shin <heesub.shin@samsung.com>
Sat, 6 May 2017 14:00:41 +0000 (23:00 +0900)
Add missing cleanup timer when test is terminated.

Change-Id: I2a3d80348e942f4b2ffec9bdd6cf697c65826668
Signed-off-by: EunBong Song <eunb.song@samsung.com>
apps/examples/iperf/iperf_api.c
apps/examples/iperf/iperf_main.c

index c9ed4fe..347e9d4 100644 (file)
@@ -1945,6 +1945,8 @@ void iperf_free_test(struct iperf_test *test)
                tmr_cancel(test->reporter_timer);
        }
 
+       tmr_cleanup();
+
        /* Free protocol list */
        while (!SLIST_EMPTY(&test->protocols)) {
                prot = SLIST_FIRST(&test->protocols);
index 27c45b8..b2bac3a 100644 (file)
@@ -130,6 +130,7 @@ int iperf_main(int argc, char **argv)
        }
 
        if (run(test) < 0) {
+               iperf_free_test(test);
                iperf_errexit(test, "error - %s", iperf_strerror(i_errno));
        }
 
@@ -162,6 +163,8 @@ static int run(struct iperf_test *test)
                break;
        case 'c':
                if (iperf_run_client(test) < 0) {
+                       close(test->ctrl_sck);
+                       iperf_free_test(test);
                        iperf_errexit(test, "error - %s", iperf_strerror(i_errno));
                }
                break;