From b9b47a0835b8ad907ca4d47fbc136f10ac3038cd Mon Sep 17 00:00:00 2001 From: kcwu Date: Tue, 8 Feb 2005 09:08:14 +0000 Subject: bug fix: don't use free'd pointer git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2481 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- util/xchatd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/util/xchatd.c b/util/xchatd.c index 3902bb79..c842f97e 100644 --- a/util/xchatd.c +++ b/util/xchatd.c @@ -2774,7 +2774,7 @@ int main() { register int msock, csock, nfds; - register ChatUser *cu; + register ChatUser *cu, *cunext; register fd_set *rptr, *xptr; fd_set rset, xset; struct timeval tv; @@ -2882,7 +2882,9 @@ main() } } - for (cu = mainuser; cu && nfds>0; cu = cu->unext) { + for (cu = mainuser; cu && nfds>0; cu = cunext) { + /* logout_user() 會 free(cu); 先把 cu->next 記下來 */ + cunext = cu->unext; csock = cu->sock; if (FD_ISSET(csock, xptr)) { logout_user(cu); -- cgit v1.2.3