diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-02-08 17:08:14 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-02-08 17:08:14 +0800 |
commit | b9b47a0835b8ad907ca4d47fbc136f10ac3038cd (patch) | |
tree | 25c523a3916f9e91aabe9b1e340145e9abce5714 | |
parent | bb7b49e02231af87b549beedc68b6f1e266b399b (diff) | |
download | pttbbs-b9b47a0835b8ad907ca4d47fbc136f10ac3038cd.tar pttbbs-b9b47a0835b8ad907ca4d47fbc136f10ac3038cd.tar.gz pttbbs-b9b47a0835b8ad907ca4d47fbc136f10ac3038cd.tar.bz2 pttbbs-b9b47a0835b8ad907ca4d47fbc136f10ac3038cd.tar.lz pttbbs-b9b47a0835b8ad907ca4d47fbc136f10ac3038cd.tar.xz pttbbs-b9b47a0835b8ad907ca4d47fbc136f10ac3038cd.tar.zst pttbbs-b9b47a0835b8ad907ca4d47fbc136f10ac3038cd.zip |
bug fix: don't use free'd pointer
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2481 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | util/xchatd.c | 6 |
1 files 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); |