Fix memory leak in rigctl_parse.c

strip_quotes() orphaned 1 or 2 strings per call.
pull/1771/head
George Baltz N3GB 2025-06-19 11:34:35 -04:00
rodzic aa39d6a618
commit 0740af61a3
1 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -497,9 +497,9 @@ void hash_delete_all()
// modifies s to remove quotes // modifies s to remove quotes
void strip_quotes(char *s) static void strip_quotes(char *s)
{ {
char *s2 = strdup(s); char *s2;
char *p; char *p;
if (s[0] != '\"') { return; } // no quotes if (s[0] != '\"') { return; } // no quotes
@ -510,6 +510,7 @@ void strip_quotes(char *s)
if (p) { *p = 0; } if (p) { *p = 0; }
strcpy(s, s2); strcpy(s, s2);
free(s2);
} }
#ifdef HAVE_LIBREADLINE #ifdef HAVE_LIBREADLINE