Sync OpenBSD patchset 614:

Don't leak if arguments appear multiple times, from Tiago Cunha.
This commit is contained in:
Tiago Cunha 2010-01-25 17:12:44 +00:00
parent 05e5bc7882
commit c744964cd9
3 changed files with 11 additions and 7 deletions

View File

@ -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,6 +79,7 @@ cmd_bind_key_parse(struct cmd *self, int argc, char **argv, char **cause)
data->can_repeat = 1;
break;
case 't':
if (data->tablename == NULL)
data->tablename = xstrdup(optarg);
break;
default:

View File

@ -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,9 +61,11 @@ 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':
if (data->name == NULL)
data->name = xstrdup(optarg);
break;
case 't':
if (data->target == NULL)
data->target = xstrdup(optarg);
break;
default:

View File

@ -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,6 +67,7 @@ cmd_unbind_key_parse(struct cmd *self, int argc, char **argv, char **cause)
no_prefix = 1;
break;
case 't':
if (data->tablename == NULL)
data->tablename = xstrdup(optarg);
break;
default: