From 7b6c05d74dc34dd6b61e07eb314048cdddc292f0 Mon Sep 17 00:00:00 2001 From: kcwu Date: Fri, 17 Jan 2003 07:59:35 +0000 Subject: fix memory leak git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@621 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/guess.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/guess.c b/mbbsd/guess.c index 539388e2..ece753b4 100644 --- a/mbbsd/guess.c +++ b/mbbsd/guess.c @@ -1,4 +1,4 @@ -/* $Id: guess.c,v 1.11 2003/01/16 14:37:32 kcwu Exp $ */ +/* $Id: guess.c,v 1.12 2003/01/17 07:59:35 kcwu Exp $ */ #include "bbs.h" #define LOGPASS BBSHOME "/etc/winguess.log" @@ -286,9 +286,9 @@ guess_main() } } move(17, 35); + free(flag); + free(n); if (ifcomputer[0]) { - free(flag); - free(n); if (count > c_count) { prints("你輸給電腦了"); move(18, 35); @@ -302,9 +302,6 @@ guess_main() fprintf(file, "電腦賺走了%s %ld Ptt$\n", cuser.userid, money); fclose(file); } - unlockutmpmode(); - pressanykey(); - return 1; } else if (count < c_count) { prints("真厲害, 讓你賺到囉"); move(18, 35); @@ -316,9 +313,6 @@ guess_main() c_count, money * 2); fclose(file); } - unlockutmpmode(); - pressanykey(); - return 1; } else { prints("真厲害, 和電腦打成平手了, 拿回本錢%lu\n", money); demoney(money); @@ -326,10 +320,10 @@ guess_main() fprintf(file, "id: %s 和電腦打成了平手\n", cuser.userid); fclose(file); } - unlockutmpmode(); - pressanykey(); - return 1; } + unlockutmpmode(); + pressanykey(); + return 1; } if (youwin) { demoney(TABLE[count] * money); -- cgit v1.2.3