Fix errors in error cases

Leak FDs in error exits, seg faults if RIG missing.
Found by `gcc -fanalyzer`
pull/1834/head
George Baltz N3GB 2025-08-06 04:56:02 -04:00
rodzic 96bc67d993
commit 1e5adb9fde
4 zmienionych plików z 8 dodań i 4 usunięć

Wyświetl plik

@ -971,8 +971,7 @@ int ft100_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
{
int ret;
int split = CACHE(rig)->split;
int ptt = CACHE(rig)->ptt;
int split, ptt;
FT100_METER_INFO ft100_meter;
@ -980,6 +979,9 @@ int ft100_get_level(RIG *rig, vfo_t vfo, setting_t level, value_t *val)
if (!val) { return -RIG_EINVAL; }
split = CACHE(rig)->split;
ptt = CACHE(rig)->ptt;
rig_debug(RIG_DEBUG_VERBOSE, "%s: %s\n", __func__, rig_strlevel(level));
// if in split have to switch to VFOB to read power and back to VFOA

Wyświetl plik

@ -198,7 +198,7 @@ gs232_rot_set_position(ROT *rot, azimuth_t az, elevation_t el)
static int
gs232_rot_get_position(ROT *rot, azimuth_t *az, elevation_t *el)
{
char posbuf[32];
char posbuf[BUFSZ];
// these really shouldn't be static but it's fixing faulty firmware -- see below
static int expected = 12;
static int expected_flag = 0;

Wyświetl plik

@ -1348,7 +1348,7 @@ int is_wireless()
static void *multicast_receiver(void *arg)
{
char data[4096];
char ip4[INET6_ADDRSTRLEN];
char ip4[INET6_ADDRSTRLEN] = "";
struct multicast_receiver_args_s *args = (struct multicast_receiver_args_s *)
arg;

Wyświetl plik

@ -1266,6 +1266,8 @@ HAMLIB_EXPORT(int) rig_settings_load_all(char *settings_file)
}
}
fclose(fp);
return RIG_OK;
}