[Hamlib-commits] Hamlib -- Ham radio control libraries branch master updated. 1cf8d03e130ebeb6553f4
Library to control radio transceivers and receivers
Brought to you by:
n0nb
|
From: n0nb <n0...@us...> - 2025-12-13 17:46:17
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Hamlib -- Ham radio control libraries".
The branch, master has been updated
via 1cf8d03e130ebeb6553f4943a6508849911e0615 (commit)
via 018c86997b264ee0abc997f3b049105a5b8bc9a1 (commit)
via 08a013b87b07272ceadf6f4bd37251d26c7ef22a (commit)
from bb39a8f73d07766925dd61b6628146983a31a3a7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 1cf8d03e130ebeb6553f4943a6508849911e0615
Author: George Baltz N3GB <Geo...@gm...>
Date: Fri Dec 12 02:39:07 2025 -0500
Missed one
diff --git a/tests/rigctltcp.c b/tests/rigctltcp.c
index 828f52f2d..ce95038a1 100644
--- a/tests/rigctltcp.c
+++ b/tests/rigctltcp.c
@@ -950,6 +950,7 @@ int main(int argc, char *argv[])
if (arg->sock < 0)
{
handle_error(RIG_DEBUG_ERR, "accept");
+ free(arg);
break;
}
commit 018c86997b264ee0abc997f3b049105a5b8bc9a1
Author: George Baltz N3GB <Geo...@gm...>
Date: Wed Dec 10 17:02:29 2025 -0500
Fix the same leak in rigctltcp.c
diff --git a/tests/rigctltcp.c b/tests/rigctltcp.c
index 05ca65dc8..828f52f2d 100644
--- a/tests/rigctltcp.c
+++ b/tests/rigctltcp.c
@@ -268,7 +268,6 @@ int main(int argc, char *argv[])
pthread_t thread;
pthread_attr_t attr;
- struct handle_data *arg;
int vfo_mode = 0; /* vfo_mode=0 means target VFO is current VFO */
int i;
extern int is_rigctld;
@@ -893,16 +892,6 @@ int main(int argc, char *argv[])
fd_set set;
struct timeval timeout;
- arg = calloc(1, sizeof(struct handle_data));
-
- if (!arg)
- {
- rig_debug(RIG_DEBUG_ERR, "calloc: %s\n", strerror(errno));
- exit(1);
- }
-
- if (rigctld_password[0] != 0) { arg->use_password = 1; }
-
/* use select to allow for periodic checks for CTRL+C */
FD_ZERO(&set);
FD_SET(sock_listen, &set);
@@ -939,6 +928,18 @@ int main(int argc, char *argv[])
}
else
{
+ struct handle_data *arg;
+
+ arg = calloc(1, sizeof(struct handle_data));
+
+ if (!arg)
+ {
+ rig_debug(RIG_DEBUG_ERR, "calloc: %s\n", strerror(errno));
+ exit(1);
+ }
+
+ if (rigctld_password[0] != 0) { arg->use_password = 1; }
+
arg->rig = my_rig;
arg->clilen = sizeof(arg->cli_addr);
arg->vfo_mode = vfo_mode;
commit 08a013b87b07272ceadf6f4bd37251d26c7ef22a
Author: George Baltz N3GB <Geo...@gm...>
Date: Wed Dec 10 13:18:49 2025 -0500
Fix memory leak in rigctld
Just started playing with valgrind, and already We have a Winner!
rigctld was leaking ~100 bytes every 5 seconds; rearrange code so
arg is not allocated until it is needed and will be passed to the
routine that will free() it.
Also fix uninitialized variable warning.
diff --git a/tests/rigctl_parse.c b/tests/rigctl_parse.c
index a7b83c5ef..2dbb06b75 100644
--- a/tests/rigctl_parse.c
+++ b/tests/rigctl_parse.c
@@ -707,7 +707,7 @@ int rigctl_parse(RIG *my_rig, FILE *fin, FILE *fout, char *argv[], int argc,
struct test_table *cmd_entry = NULL;
struct rig_state *rs = STATE(my_rig);
- char command[MAXARGSZ + 1];
+ char command[MAXARGSZ + 1] = "";
char arg1[MAXARGSZ + 1], *p1 = NULL;
char arg2[MAXARGSZ + 1], *p2 = NULL;
char arg3[MAXARGSZ + 1], *p3 = NULL;
diff --git a/tests/rigctld.c b/tests/rigctld.c
index 620557f42..ab6138a60 100644
--- a/tests/rigctld.c
+++ b/tests/rigctld.c
@@ -272,7 +272,6 @@ int main(int argc, char *argv[])
pthread_t thread;
pthread_attr_t attr;
- struct handle_data *arg;
int vfo_mode = 0; /* vfo_mode=0 means target VFO is current VFO */
int i;
extern int is_rigctld;
@@ -988,16 +987,6 @@ int main(int argc, char *argv[])
fd_set set;
struct timeval timeout;
- arg = calloc(1, sizeof(struct handle_data));
-
- if (!arg)
- {
- rig_debug(RIG_DEBUG_ERR, "calloc: %s\n", strerror(errno));
- exit(1);
- }
-
- if (rigctld_password[0] != 0) { arg->use_password = 1; }
-
/* use select to allow for periodic checks for CTRL+C */
FD_ZERO(&set);
FD_SET(sock_listen, &set);
@@ -1034,6 +1023,18 @@ int main(int argc, char *argv[])
}
else
{
+ struct handle_data *arg;
+
+ arg = calloc(1, sizeof(struct handle_data));
+
+ if (!arg)
+ {
+ rig_debug(RIG_DEBUG_ERR, "calloc: %s\n", strerror(errno));
+ exit(1);
+ }
+
+ if (rigctld_password[0] != 0) { arg->use_password = 1; }
+
arg->rig = my_rig;
arg->clilen = sizeof(arg->cli_addr);
arg->vfo_mode = vfo_mode;
@@ -1044,6 +1045,7 @@ int main(int argc, char *argv[])
if (arg->sock < 0)
{
handle_error(RIG_DEBUG_ERR, "accept");
+ free(arg);
break;
}
-----------------------------------------------------------------------
Summary of changes:
tests/rigctl_parse.c | 2 +-
tests/rigctld.c | 24 +++++++++++++-----------
tests/rigctltcp.c | 24 +++++++++++++-----------
3 files changed, 27 insertions(+), 23 deletions(-)
hooks/post-receive
--
Hamlib -- Ham radio control libraries
|