PATCH: named pipe server refcounting

Marcus Meissner marcus at jet.franken.de
Sat Jan 12 11:03:16 CST 2002


Hi,

If I kill a thread with a named pipe still open (like with 'killall wine'),
the wineserver crashes while accessing a freed thread structure.

This patch adds refcounting for the thread structure, dunno if it is
correct.

Ciao, Marcus

Changelog:
	Add refcounting to the thread member of the pipe user.

Index: named_pipe.c
===================================================================
RCS file: /home/wine/wine/server/named_pipe.c,v
retrieving revision 1.9
diff -u -r1.9 named_pipe.c
--- named_pipe.c	2002/01/09 20:30:52	1.9
+++ named_pipe.c	2002/01/12 15:16:30
@@ -134,6 +134,8 @@
         thread_queue_apc(user->thread,NULL,user->func,
             APC_ASYNC,1,2,user->overlapped,status);
     }
+    if (user->thread)
+	release_object(user->thread);
     user->thread = NULL;
     user->func = NULL;
     user->overlapped=NULL;
@@ -361,7 +363,7 @@
     else
     {
         user->state = ps_wait_open;
-        user->thread = current;
+        user->thread = grab_object(current);
         user->func = req->func;
         user->overlapped = req->overlapped;
 




More information about the wine-patches mailing list