From 55b8c21f0fdc18f2cc5720e5791f3ede9352efbe Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Wed, 17 Nov 1999 14:22:12 +0000 Subject: [PATCH] Fix potential segfault on malloc failure [originally from svn r323] --- window.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/window.c b/window.c index 0a688573..4aae4226 100644 --- a/window.c +++ b/window.c @@ -678,8 +678,10 @@ static int WINAPI WndProc (HWND hwnd, UINT message, cl = malloc(16 + strlen(session)); /* 8, but play safe */ if (!cl) cl = NULL; /* not a very important failure mode */ - sprintf(cl, "putty @%s", session); - freecl = TRUE; + else { + sprintf(cl, "putty @%s", session); + freecl = TRUE; + } } else cl = NULL;