From c989dbc409badcaa1c81e111c2a03ddeff9ec668 Mon Sep 17 00:00:00 2001 From: simon Date: Sat, 17 Jan 2004 14:25:36 +0000 Subject: [PATCH] Various uninitialised-variable accesses picked up by valgrind. git-svn-id: svn://svn.tartarus.org/sgt/putty@3723 cda61777-01e9-0310-a592-d414129be87e --- terminal.c | 39 +++++++++++++++++++++------------------ unix/gtkdlg.c | 2 ++ 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/terminal.c b/terminal.c index 1fa66e12..cb00ea6e 100644 --- a/terminal.c +++ b/terminal.c @@ -850,26 +850,29 @@ static void scroll(Terminal *term, int topline, int botline, int lines, int sb) */ seltop = sb ? -term->savelines : topline; - if (term->selstart.y >= seltop && - term->selstart.y <= botline) { - term->selstart.y--; - if (term->selstart.y < seltop) { - term->selstart.y = seltop; - term->selstart.x = 0; + if (term->selstate != NO_SELECTION) { + if (term->selstart.y >= seltop && + term->selstart.y <= botline) { + term->selstart.y--; + if (term->selstart.y < seltop) { + term->selstart.y = seltop; + term->selstart.x = 0; + } } - } - if (term->selend.y >= seltop && term->selend.y <= botline) { - term->selend.y--; - if (term->selend.y < seltop) { - term->selend.y = seltop; - term->selend.x = 0; + if (term->selend.y >= seltop && term->selend.y <= botline) { + term->selend.y--; + if (term->selend.y < seltop) { + term->selend.y = seltop; + term->selend.x = 0; + } } - } - if (term->selanchor.y >= seltop && term->selanchor.y <= botline) { - term->selanchor.y--; - if (term->selanchor.y < seltop) { - term->selanchor.y = seltop; - term->selanchor.x = 0; + if (term->selanchor.y >= seltop && + term->selanchor.y <= botline) { + term->selanchor.y--; + if (term->selanchor.y < seltop) { + term->selanchor.y = seltop; + term->selanchor.x = 0; + } } } diff --git a/unix/gtkdlg.c b/unix/gtkdlg.c index 4ca84573..7e30adbe 100644 --- a/unix/gtkdlg.c +++ b/unix/gtkdlg.c @@ -152,6 +152,8 @@ static void dlg_init(struct dlgparam *dp) dp->coloursel_result.ok = FALSE; dp->treeitems = NULL; dp->window = dp->cancelbutton = dp->currtreeitem = NULL; + dp->flags = 0; + dp->currfocus = NULL; } static void dlg_cleanup(struct dlgparam *dp) -- 2.11.0