summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2024-05-13 11:45:06 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2024-05-13 11:45:06 +0000
commit4ec9b3a2d95c6f34bce6c52d0c360ae2a0ebdc50 (patch)
treebca450f8f23772a9d3a458141d7ce3dcfc2c83e8 /usr.bin/tmux
parent6e1f4b70c4bfb2918fa6bbbf73e84974b2b9f3e8 (diff)
Fix memory leak, from Fadi Afani.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/arguments.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/tmux/arguments.c b/usr.bin/tmux/arguments.c
index bff135ca0e6..71d1cf22118 100644
--- a/usr.bin/tmux/arguments.c
+++ b/usr.bin/tmux/arguments.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arguments.c,v 1.63 2024/04/15 08:19:55 nicm Exp $ */
+/* $OpenBSD: arguments.c,v 1.64 2024/05/13 11:45:05 nicm Exp $ */
/*
* Copyright (c) 2010 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -164,15 +164,17 @@ args_parse_flag_argument(struct args_value *values, u_int count, char **cause,
argument = &values[*i];
if (argument->type != ARGS_STRING) {
xasprintf(cause, "-%c argument must be a string", flag);
+ args_free_value(new);
+ free(new);
return (-1);
}
}
if (argument == NULL) {
+ args_free_value(new);
+ free(new);
if (optional_argument) {
log_debug("%s: -%c (optional)", __func__, flag);
args_set(args, flag, NULL, ARGS_ENTRY_OPTIONAL_VALUE);
- args_free_value(new);
- free(new);
return (0); /* either - or end */
}
xasprintf(cause, "-%c expects an argument", flag);