From: simon Date: Wed, 17 Nov 1999 14:22:12 +0000 (+0000) Subject: Fix potential segfault on malloc failure X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/commitdiff_plain/94e6450e42105f766bb38f6b04d337b44cabc675 Fix potential segfault on malloc failure git-svn-id: svn://svn.tartarus.org/sgt/putty@323 cda61777-01e9-0310-a592-d414129be87e --- 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;