Hi
There is no need to duplicate options->send_env[i] only free it
in all cases. Just use options->send_env[i] directly.
Best,
Martin
Index: readconf.c
===================================================================
RCS file: /cvs/src/usr.bin/ssh/readconf.c,v
retrieving revision 1.366
diff -u -p -r1.366 readconf.c
--- readconf.c 8 Feb 2022 08:59:12 -0000 1.366
+++ readconf.c 19 Apr 2022 09:38:48 -0000
@@ -740,19 +740,15 @@ static void
rm_env(Options *options, const char *arg, const char *filename, int linenum)
{
int i, j, onum_send_env = options->num_send_env;
- char *cp;
/* Remove an environment variable */
for (i = 0; i < options->num_send_env; ) {
- cp = xstrdup(options->send_env[i]);
- if (!match_pattern(cp, arg + 1)) {
- free(cp);
+ if (!match_pattern(options->send_env[i], arg + 1)) {
i++;
continue;
}
debug3("%s line %d: removing environment %s",
- filename, linenum, cp);
- free(cp);
+ filename, linenum, options->send_env[i]);
free(options->send_env[i]);
options->send_env[i] = NULL;
for (j = i; j < options->num_send_env - 1; j++) {