From 8fcfc2479f8072c00798fcbea93309d41af5ef2a Mon Sep 17 00:00:00 2001 From: g-coder Date: Thu, 26 May 2016 21:17:29 +0530 Subject: [PATCH] DEREF_AFTER_NULL in src/iperf_error.c (#423) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DEREF_AFTER_NULL: pointer ‘test’ at line:77 is passed as an argument to function iperf_delete_pidfile(), in which it is dereferenced at iperf_api.c:2832. Pointer ‘test’ can be NULL and dereferencing a NULL pointer causes seg-fault. Applied Fix: pointer ‘test’ is checked for NULL before passing it to function iperf_delete_pidfile(). --- src/iperf_error.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/iperf_error.c b/src/iperf_error.c index 9201cb7..9a752d3 100644 --- a/src/iperf_error.c +++ b/src/iperf_error.c @@ -74,7 +74,8 @@ iperf_errexit(struct iperf_test *test, const char *format, ...) fprintf(stderr, "iperf3: %s\n", str); } va_end(argp); - iperf_delete_pidfile(test); + if (test) + iperf_delete_pidfile(test); exit(1); }