diff options
author | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-03-23 15:26:52 +0000 |
---|---|---|
committer | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-03-23 15:26:52 +0000 |
commit | 33b8fd47955eeab26cede233b14d683b8e0491b8 (patch) | |
tree | 041f7df2acc8b46bdb56512f06b0f9706fe6ec29 /src/login_sql | |
parent | 7d3fedfa5c264169c544fe3ec977229c50e4baa2 (diff) | |
download | hercules-33b8fd47955eeab26cede233b14d683b8e0491b8.tar.gz hercules-33b8fd47955eeab26cede233b14d683b8e0491b8.tar.bz2 hercules-33b8fd47955eeab26cede233b14d683b8e0491b8.tar.xz hercules-33b8fd47955eeab26cede233b14d683b8e0491b8.zip |
* Fixed alot of memory leaks
* Added stray memory cleaning routine to db.c
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1275 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/login_sql')
-rw-r--r-- | src/login_sql/login.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/src/login_sql/login.c b/src/login_sql/login.c index 91fc9ccb8..071b6d32c 100644 --- a/src/login_sql/login.c +++ b/src/login_sql/login.c @@ -41,30 +41,19 @@ void Gettimeofday(struct timeval *timenow) #include <signal.h> #include <fcntl.h> #include <string.h> -#include "malloc.h" //add include for DBMS(mysql) #include <mysql.h> -#include "../common/strlib.h" -#include "timer.h" -/* -#include "timer.h" -#include "core.h" -#include "socket.h" -#include "login.h" -#include "mmo.h" -#include "version.h" -#include "db.h" -*/ - #include "../common/core.h" #include "../common/socket.h" -#include "login.h" -#include "../common/mmo.h" -#include "../common/version.h" +#include "../common/malloc.h" #include "../common/db.h" #include "../common/timer.h" +#include "../common/strlib.h" +#include "../common/mmo.h" +#include "../common/version.h" +#include "login.h" #ifdef PASSWORDENC #include "md5calc.h" @@ -1835,6 +1824,24 @@ int flush_timer(int tid, unsigned int tick, int id, int data){ return 0; } +//-------------------------------------- +// Function called at exit of the server +//-------------------------------------- +static int online_db_final(void *key,void *data,va_list ap) +{ + int *p = data; + if (p) aFree(p); + return 0; +} +void do_final(void) { + //sync account when terminating. + //but no need when you using DBMS (mysql) + mmo_db_close(); + numdb_final(online_db, online_db_final); + exit_dbn(); + timer_final(); +} + int do_init(int argc,char **argv){ //initialize login server int i; @@ -1876,9 +1883,7 @@ int do_init(int argc,char **argv){ printf ("Running mmo_auth_sqldb_init()\n"); mmo_auth_sqldb_init(); printf ("finished mmo_auth_sqldb_init()\n"); - //sync account when terminating. - //but no need when you using DBMS (mysql) - set_termfunc(mmo_db_close); + set_termfunc(do_final); //set default parser as parse_login function set_defaultparse(parse_login); |