diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2011-01-30 12:09:31 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2011-01-30 12:09:31 +0000 |
commit | 8cbdabc3d746537405513d5ed798507cab5bcb77 (patch) | |
tree | fd1e319b3b2e7263417d94281aed0d892dab0252 /usr.bin/tmux | |
parent | 970f25c5d1217bf7ff20823e033cba10ef002fa7 (diff) |
Free old argument even if setting to NULL.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/arguments.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.bin/tmux/arguments.c b/usr.bin/tmux/arguments.c index f0e2e6dc55a..06d4cc2f03e 100644 --- a/usr.bin/tmux/arguments.c +++ b/usr.bin/tmux/arguments.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arguments.c,v 1.1 2011/01/04 00:42:46 nicm Exp $ */ +/* $OpenBSD: arguments.c,v 1.2 2011/01/30 12:09:30 nicm Exp $ */ /* * Copyright (c) 2010 Nicholas Marriott <nicm@users.sourceforge.net> @@ -183,11 +183,12 @@ args_has(struct args *args, u_char ch) void args_set(struct args *args, u_char ch, const char *value) { - if (value != NULL) { - if (args->values[ch] != NULL) - xfree(args->values[ch]); + if (args->values[ch] != NULL) + xfree(args->values[ch]); + if (value != NULL) args->values[ch] = xstrdup(value); - } + else + args->values[ch] = NULL; bit_set(args->flags, ch); } |