From 0d04d4c31248fe58c67660bbde07ebb892f874a6 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 26 Nov 2007 10:27:59 +0000 Subject: 24120: termcap string memory allocation was screwy --- Src/init.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Src/init.c') diff --git a/Src/init.c b/Src/init.c index 55f32079b..bd582ad2b 100644 --- a/Src/init.c +++ b/Src/init.c @@ -598,19 +598,22 @@ init_term(void) if (tccan(TCUP)) termflags &= ~TERM_NOUP; else { + zsfree(tcstr[TCUP]); tcstr[TCUP] = NULL; termflags |= TERM_NOUP; } /* most termcaps don't define "bc" because they use \b. */ if (!tccan(TCBACKSPACE)) { + zsfree(tcstr[TCBACKSPACE]); tcstr[TCBACKSPACE] = ztrdup("\b"); tclen[TCBACKSPACE] = 1; } /* if there's no termcap entry for cursor left, use backspace. */ if (!tccan(TCLEFT)) { - tcstr[TCLEFT] = tcstr[TCBACKSPACE]; + zsfree(tcstr[TCLEFT]); + tcstr[TCLEFT] = ztrdup(tcstr[TCBACKSPACE]); tclen[TCLEFT] = tclen[TCBACKSPACE]; } @@ -629,6 +632,7 @@ init_term(void) /* if there's no termcap entry for clear, use ^L. */ if (!tccan(TCCLEARSCREEN)) { + zsfree(tcstr[TCCLEARSCREEN]); tcstr[TCCLEARSCREEN] = ztrdup("\14"); tclen[TCCLEARSCREEN] = 1; } -- cgit 1.4.1