diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2010-01-23 17:50:56 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2010-01-23 17:50:56 +0000 |
commit | c0d3e4315c4465d2c665ab2a9151ac31e72f6882 (patch) | |
tree | cd4ee258223647b836a87a7f7b6b0617c5d1cfd3 | |
parent | 8865eb2866971d1f82876546154f3032e915348b (diff) | |
download | rtmux-c0d3e4315c4465d2c665ab2a9151ac31e72f6882.tar.gz rtmux-c0d3e4315c4465d2c665ab2a9151ac31e72f6882.tar.bz2 rtmux-c0d3e4315c4465d2c665ab2a9151ac31e72f6882.zip |
Don't leak if arguments appear multiple times, from Tiago Cunha.
-rw-r--r-- | cmd-bind-key.c | 3 | ||||
-rw-r--r-- | cmd-switch-client.c | 6 | ||||
-rw-r--r-- | cmd-unbind-key.c | 3 |
3 files changed, 8 insertions, 4 deletions
diff --git a/cmd-bind-key.c b/cmd-bind-key.c index 4ed84ac3..c535612f 100644 --- a/cmd-bind-key.c +++ b/cmd-bind-key.c @@ -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 9ff1c081..03cb7c8d 100644 --- a/cmd-switch-client.c +++ b/cmd-switch-client.c @@ -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 4633274d..c5a97301 100644 --- a/cmd-unbind-key.c +++ b/cmd-unbind-key.c @@ -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; |