Fix a memory leak, from Japin Li in GitHub issue 3358.
authornicm <nicm@openbsd.org>
Tue, 25 Oct 2022 09:12:05 +0000 (09:12 +0000)
committernicm <nicm@openbsd.org>
Tue, 25 Oct 2022 09:12:05 +0000 (09:12 +0000)
usr.bin/tmux/cmd-parse.y

index 71ce9ab..abfc53c 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-parse.y,v 1.48 2021/09/10 08:52:46 nicm Exp $ */
+/* $OpenBSD: cmd-parse.y,v 1.49 2022/10/25 09:12:05 nicm Exp $ */
 
 /*
  * Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1086,7 +1086,8 @@ cmd_parse_from_arguments(struct args_value *values, u_int count,
                                arg->type = CMD_PARSE_STRING;
                                arg->string = copy;
                                TAILQ_INSERT_TAIL(&cmd->arguments, arg, entry);
-                       }
+                       } else
+                               free(copy);
                } else if (values[i].type == ARGS_COMMANDS) {
                        arg = xcalloc(1, sizeof *arg);
                        arg->type = CMD_PARSE_PARSED_COMMANDS;