summaryrefslogtreecommitdiffstats
path: root/tty-term.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-08-03 15:30:16 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-08-03 15:30:16 +0000
commitac54dee9bbd33e71910fed8d5f8ddb1cde9b9a35 (patch)
tree63c4a404fd123073c586028289405907be0b31f0 /tty-term.c
parent9a391b33202fbab9a76812a763ac6252187bafdd (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 'tty-term.c')
-rw-r--r--tty-term.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tty-term.c b/tty-term.c
index 2813be61..c96bdb12 100644
--- a/tty-term.c
+++ b/tty-term.c
@@ -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;