diff --git a/src/terminal/kbd.c b/src/terminal/kbd.c index af37ebd1b..32a4ec8ec 100644 --- a/src/terminal/kbd.c +++ b/src/terminal/kbd.c @@ -500,7 +500,10 @@ dispatch_special(unsigned char *text) if (ditrm->remote) break; - if (!ditrm->orig_title) + /* If ditrm->touched_title is 0, then + * ditrm->orig_title should be NULL, + * but check it to prevent any leak. */ + if (!ditrm->orig_title && !ditrm->touched_title) ditrm->orig_title = get_window_title(); ditrm->touched_title = 1; }