From 5cab1acc0dd5523fe0d0e9959f53bf1034e502d2 Mon Sep 17 00:00:00 2001 From: Mike Black W9MDB Date: Thu, 5 Aug 2021 07:50:15 -0500 Subject: [PATCH] In rigctld do not try to close fsockin/fsockout when null -- happens during error on fsockin or fsockout https://github.com/Hamlib/Hamlib/issues/757 --- Segfault-award | 3 +++ tests/rigctld.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Segfault-award b/Segfault-award index c70882079..f80986d0b 100644 --- a/Segfault-award +++ b/Segfault-award @@ -22,3 +22,6 @@ Here is the list of the brave fellows: * Charles Suprin AA1VS, v1.2.12, 02/2011, all user programs/daemons $ rigctl -C MGP +* Chuck Ritola + fclose of fsockin or fsockout when null + https://github.com/Hamlib/Hamlib/issues/757 diff --git a/tests/rigctld.c b/tests/rigctld.c index a670b742a..3a748810e 100644 --- a/tests/rigctld.c +++ b/tests/rigctld.c @@ -1221,8 +1221,8 @@ handle_exit: if (retcode != 0) { rig_debug(RIG_DEBUG_ERR, "%s: fclose(fsockin) %s\n", __func__, strerror(retcode)); } #endif - fclose(fsockin); - fclose(fsockout); + if (fsockin) fclose(fsockin); + if (fsockout) fclose(fsockout); // for everybody else we close the handle after fclose #ifndef __MINGW32__