summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-08-03 15:30:17 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-08-03 15:30:17 +0000
commitb0f30589dbd98ecd25a2559dbbda1d3f73edd70e (patch)
tree16affc167d95040e8f66c892acef78086345b194 /usr.bin
parent31a49535dd5e2d4c38f460079e3687f29f171d36 (diff)
Don't try to free old string values (and crash) when they are overridden unless
they were actually found in the source terminal description. Reported by jmc.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/tty-term.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/tmux/tty-term.c b/usr.bin/tmux/tty-term.c
index 2fa78639020..8513d8595aa 100644
--- a/usr.bin/tmux/tty-term.c
+++ b/usr.bin/tmux/tty-term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty-term.c,v 1.5 2009/08/03 14:10:54 nicm Exp $ */
+/* $OpenBSD: tty-term.c,v 1.6 2009/08/03 15:30:16 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -196,7 +196,8 @@ tty_term_override(struct tty_term *term, const char *overrides)
case TTYCODE_NONE:
break;
case TTYCODE_STRING:
- xfree(code->value.string);
+ if (code->type == TTYCODE_STRING)
+ xfree(code->value.string);
code->value.string = xstrdup(val);
code->type = ent->type;
break;