[Hamlib-commits] Hamlib -- Ham radio control libraries branch Hamlib-4.7 updated. b7790198465d9aad7
Library to control radio transceivers and receivers
Brought to you by:
n0nb
|
From: n0nb <n0...@us...> - 2025-12-13 17:53:23
|
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, Hamlib-4.7 has been updated
via b7790198465d9aad7ac90d64eeb8cb27dea9c60b (commit)
via 813f210979ef6cf4f8ce0a33a2b37c77d10d0756 (commit)
from 8488fa21ac58fd263f15c5878dc948e070928bfc (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 b7790198465d9aad7ac90d64eeb8cb27dea9c60b
Author: George Baltz N3GB <Geo...@gm...>
Date: Wed Dec 10 17:02:29 2025 -0500
Fix the same leak in rigctltcp.c
(cherry picked from commit 018c86997b264ee0abc997f3b049105a5b8bc9a1)
Missed one
(cherry picked from commit 1cf8d03e130ebeb6553f4943a6508849911e0615)
diff --git a/tests/rigctltcp.c b/tests/rigctltcp.c
index 05ca65dc8..ce95038a1 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;
@@ -949,6 +950,7 @@ int main(int argc, char *argv[])
if (arg->sock < 0)
{
handle_error(RIG_DEBUG_ERR, "accept");
+ free(arg);
break;
}
commit 813f210979ef6cf4f8ce0a33a2b37c77d10d0756
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.
(cherry picked from commit 08a013b87b07272ceadf6f4bd37251d26c7ef22a)
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
|