Following test cause data abort of iperf client.
iperf -s
iperf -c 127.0.0.1
iperf -c 127.0.0.1
Data abort can happen when iperf_run_client returns negative value.
In this case, iperf calls iperf_free_test -> iperf_client_end ->
iperf_free_test. This cause data abort because test is already freed
in iperf_free_test however iperf_client_end tries to use test pointer.
And also iperf_free_test tries to free again test pointer.
This patch re-organize the process this procedure.
Change-Id: I0ad6d986cd2457648eb2a99a078b8fa3af9e3ed7
Signed-off-by: EunBong Song <eunb.song@samsung.com>
goto main_exit;
}
+
if (run(test) < 0) {
printf("error - %s\n", iperf_strerror(i_errno));
goto main_exit;
break;
case 'c':
if (iperf_run_client(test) < 0) {
+ struct iperf_stream *sp;
+
+ iperf_set_send_state(test, IPERF_DONE);
close(test->ctrl_sck);
- iperf_client_end(test);
+ SLIST_FOREACH(sp, &test->streams, streams) {
+ close(sp->socket);
+ }
iperf_free_test(test);
printf("error - %s\n", iperf_strerror(i_errno));
- goto run_exit;
+ exit(1);
}
break;
default:
break;
}
-run_exit:
return 0;
}