Fix potential segfault on malloc failure
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 17 Nov 1999 14:22:12 +0000 (14:22 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Wed, 17 Nov 1999 14:22:12 +0000 (14:22 +0000)
git-svn-id: svn://svn.tartarus.org/sgt/putty@323 cda61777-01e9-0310-a592-d414129be87e

window.c

index 0a68857..4aae422 100644 (file)
--- 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;