summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-01-04 04:50:43 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-01-04 04:50:43 +0000
commit9081aa1f18b43e0e28f8a04b85bdceb555951c72 (patch)
tree8209e65c7dd2d63a69328c7a3c3851b61486fea3 /src
parentf00d66aa89b5022dbc6d10f867acca2f72d8cf0c (diff)
downloadhercules-9081aa1f18b43e0e28f8a04b85bdceb555951c72.tar.gz
hercules-9081aa1f18b43e0e28f8a04b85bdceb555951c72.tar.bz2
hercules-9081aa1f18b43e0e28f8a04b85bdceb555951c72.tar.xz
hercules-9081aa1f18b43e0e28f8a04b85bdceb555951c72.zip
Fixed atcommand aliases memory leak, bugreport:5200
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15383 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/atcommand.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 1c59b81a2..03ce58015 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -9332,10 +9332,25 @@ int atcommand_config_read(const char* cfgName)
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() {
if( atcommand_db != NULL )
- db_destroy(atcommand_db);
+ atcommand_db_clear();
atcommand_db = stridb_alloc(DB_OPT_DUP_KEY, 0);
atcommand_basecommands();//fills initial atcommand_db with known commands
@@ -9355,8 +9370,8 @@ void do_init_atcommand() {
}
void do_final_atcommand() {
-
- db_destroy(atcommand_db);
+
+ atcommand_db_clear();
return;
}