Skip to content

Commit

Permalink
Merge pull request #1807 from martin-ottens/master
Browse files Browse the repository at this point in the history
Fix Segfault in iperf_err(exit)
  • Loading branch information
swlars authored Feb 10, 2025
2 parents 7e58c53 + bd292ee commit 296222d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/iperf_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ iperf_errexit(struct iperf_test *test, const char *format, ...)
}
iperf_json_finish(test);
} else {
if (pthread_mutex_lock(&(test->print_mutex)) != 0) {
if (test != NULL && pthread_mutex_lock(&(test->print_mutex)) != 0) {
perror("iperf_errexit: pthread_mutex_lock");
}

Expand All @@ -128,7 +128,7 @@ iperf_errexit(struct iperf_test *test, const char *format, ...)
fprintf(stderr, "iperf3: %s\n", str);
}

if (pthread_mutex_unlock(&(test->print_mutex)) != 0) {
if (test != NULL && pthread_mutex_unlock(&(test->print_mutex)) != 0) {
perror("iperf_errexit: pthread_mutex_unlock");
}
}
Expand Down

0 comments on commit 296222d

Please sign in to comment.