Fixed atcommand aliases memory leak, bugreport:5200
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@15383 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
9558a9cace
commit
21b0b61a99
@ -9332,10 +9332,25 @@ int atcommand_config_read(const char* cfgName)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int atcommand_db_free(DBKey key,void *data,va_list va) {
|
||||||
|
|
||||||
|
aFree((AtCommandInfo*)data);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void atcommand_db_clear() {
|
||||||
|
|
||||||
|
atcommand_db->foreach(atcommand_db,atcommand_db_free);
|
||||||
|
db_destroy(atcommand_db);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
void atcommand_doload() {
|
void atcommand_doload() {
|
||||||
|
|
||||||
if( atcommand_db != NULL )
|
if( atcommand_db != NULL )
|
||||||
db_destroy(atcommand_db);
|
atcommand_db_clear();
|
||||||
|
|
||||||
atcommand_db = stridb_alloc(DB_OPT_DUP_KEY, 0);
|
atcommand_db = stridb_alloc(DB_OPT_DUP_KEY, 0);
|
||||||
atcommand_basecommands();//fills initial atcommand_db with known commands
|
atcommand_basecommands();//fills initial atcommand_db with known commands
|
||||||
@ -9356,7 +9371,7 @@ void do_init_atcommand() {
|
|||||||
|
|
||||||
void do_final_atcommand() {
|
void do_final_atcommand() {
|
||||||
|
|
||||||
db_destroy(atcommand_db);
|
atcommand_db_clear();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user