OSDN Git Service

* fhandler_tty.cc (fhandler_tty_slave::close): Avoid potential crash
authorcorinna <corinna>
Fri, 2 Apr 2010 14:11:45 +0000 (14:11 +0000)
committercorinna <corinna>
Fri, 2 Apr 2010 14:11:45 +0000 (14:11 +0000)
if former open call has been unsuccessful.

winsup/cygwin/ChangeLog
winsup/cygwin/fhandler_tty.cc

index a57cd08..4a091f2 100644 (file)
@@ -1,3 +1,8 @@
+2010-04-02  Corinna Vinschen  <corinna@vinschen.de>
+
+       * fhandler_tty.cc (fhandler_tty_slave::close): Avoid potential crash
+       if former open call has been unsuccessful.
+
 2010-04-01  Corinna Vinschen  <corinna@vinschen.de>
 
        * nlsfuncs.cc: Fix indentation.
index 4e4dc53..e9471ce 100644 (file)
@@ -613,10 +613,11 @@ fhandler_tty_slave::close ()
      close this normally.  cgf 2006-05-20 */
   cygheap->manage_console_count ("fhandler_tty_slave::close", -1);
 
-  archetype->usecount--;
+  if (archetype)
+    archetype->usecount--;
   report_tty_counts (this, "closed", "");
 
-  if (archetype->usecount)
+  if (archetype && archetype->usecount)
     {
 #ifdef DEBUGGING
       if (archetype->usecount < 0)