aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2010-01-25 17:12:44 +0000
committerTiago Cunha <tcunha@gmx.com>2010-01-25 17:12:44 +0000
commitc744964cd96554415a8a707c47eef3e0db0a60af (patch)
tree4fb116b3e06c5f65512bb0cdfa1d174b0d150e14
parent05e5bc78820633c152c15a305f12d849f0ed0b83 (diff)
downloadrtmux-c744964cd96554415a8a707c47eef3e0db0a60af.tar.gz
rtmux-c744964cd96554415a8a707c47eef3e0db0a60af.tar.bz2
rtmux-c744964cd96554415a8a707c47eef3e0db0a60af.zip
Sync OpenBSD patchset 614:
Don't leak if arguments appear multiple times, from Tiago Cunha.
-rw-r--r--cmd-bind-key.c5
-rw-r--r--cmd-switch-client.c8
-rw-r--r--cmd-unbind-key.c5
3 files changed, 11 insertions, 7 deletions
diff --git a/cmd-bind-key.c b/cmd-bind-key.c
index 6f292629..3bb613eb 100644
--- a/cmd-bind-key.c
+++ b/cmd-bind-key.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-bind-key.c,v 1.27 2009-12-04 22:14:47 tcunha Exp $ */
+/* $Id: cmd-bind-key.c,v 1.28 2010-01-25 17:12:44 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -79,7 +79,8 @@ cmd_bind_key_parse(struct cmd *self, int argc, char **argv, char **cause)
data->can_repeat = 1;
break;
case 't':
- data->tablename = xstrdup(optarg);
+ if (data->tablename == NULL)
+ data->tablename = xstrdup(optarg);
break;
default:
goto usage;
diff --git a/cmd-switch-client.c b/cmd-switch-client.c
index 4edaccf6..09addc30 100644
--- a/cmd-switch-client.c
+++ b/cmd-switch-client.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-switch-client.c,v 1.18 2009-11-14 17:56:39 tcunha Exp $ */
+/* $Id: cmd-switch-client.c,v 1.19 2010-01-25 17:12:44 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -61,10 +61,12 @@ cmd_switch_client_parse(struct cmd *self, int argc, char **argv, char **cause)
while ((opt = getopt(argc, argv, "c:t:")) != -1) {
switch (opt) {
case 'c':
- data->name = xstrdup(optarg);
+ if (data->name == NULL)
+ data->name = xstrdup(optarg);
break;
case 't':
- data->target = xstrdup(optarg);
+ if (data->target == NULL)
+ data->target = xstrdup(optarg);
break;
default:
goto usage;
diff --git a/cmd-unbind-key.c b/cmd-unbind-key.c
index b1618470..f420bd74 100644
--- a/cmd-unbind-key.c
+++ b/cmd-unbind-key.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-unbind-key.c,v 1.21 2009-11-14 17:56:39 tcunha Exp $ */
+/* $Id: cmd-unbind-key.c,v 1.22 2010-01-25 17:12:44 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -67,7 +67,8 @@ cmd_unbind_key_parse(struct cmd *self, int argc, char **argv, char **cause)
no_prefix = 1;
break;
case 't':
- data->tablename = xstrdup(optarg);
+ if (data->tablename == NULL)
+ data->tablename = xstrdup(optarg);
break;
default:
goto usage;