summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-08-28 02:45:20 +0200
committerHaru <haru@dotalux.com>2015-09-08 10:28:09 +0200
commit860f4eb744af463dd4a0e7d11e7882973ccf1e44 (patch)
tree504474d504267378c41032fec51f3ee148e36edd
parent1cfcb9df15419adf67353098c1c69b61f5c93baf (diff)
downloadhercules-860f4eb744af463dd4a0e7d11e7882973ccf1e44.tar.gz
hercules-860f4eb744af463dd4a0e7d11e7882973ccf1e44.tar.bz2
hercules-860f4eb744af463dd4a0e7d11e7882973ccf1e44.tar.xz
hercules-860f4eb744af463dd4a0e7d11e7882973ccf1e44.zip
Fixed some memory leaks in code using libconfig
- Special thanks to Dastgir Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--src/common/HPM.c2
-rw-r--r--src/map/battleground.c2
-rw-r--r--src/map/channel.c2
-rw-r--r--src/map/clif.c4
-rw-r--r--src/map/map.c4
-rw-r--r--src/map/quest.c1
-rw-r--r--src/map/script.c1
7 files changed, 9 insertions, 7 deletions
diff --git a/src/common/HPM.c b/src/common/HPM.c
index a78f03daa..6d68d6ed6 100644
--- a/src/common/HPM.c
+++ b/src/common/HPM.c
@@ -580,8 +580,8 @@ void hplugins_config_read(void) {
snprintf(filename, 60, "plugins/%s%s", libconfig->setting_get_string_elem(plist,i), DLL_EXT);
HPM->load(filename);
}
- libconfig->destroy(&plugins_conf);
}
+ libconfig->destroy(&plugins_conf);
if( HPM->plugin_count )
ShowStatus("HPM: There are '"CL_WHITE"%d"CL_RESET"' plugins loaded, type '"CL_WHITE"plugins"CL_RESET"' to list them\n", HPM->plugin_count);
diff --git a/src/map/battleground.c b/src/map/battleground.c
index 915ccc851..19360cd97 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -457,8 +457,8 @@ void bg_config_read(void) {
}
bg->arenas = arena_count;
}
- libconfig->destroy(&bg_conf);
}
+ libconfig->destroy(&bg_conf);
}
struct bg_arena *bg_name2arena (char *name) {
int i;
diff --git a/src/map/channel.c b/src/map/channel.c
index 337d05504..6e15d072e 100644
--- a/src/map/channel.c
+++ b/src/map/channel.c
@@ -770,8 +770,8 @@ void read_channels_config(void)
}
ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' channels in '"CL_WHITE"%s"CL_RESET"'.\n", db_size(channel->db), config_filename);
- libconfig->destroy(&channels_conf);
}
+ libconfig->destroy(&channels_conf);
}
/*==========================================
diff --git a/src/map/clif.c b/src/map/clif.c
index 12565de3c..ac1052c71 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -17101,8 +17101,8 @@ void clif_cashshop_db(void) {
}
}
- libconfig->destroy(&cashshop_conf);
}
+ libconfig->destroy(&cashshop_conf);
ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", item_count_t, config_filename);
}
/// Items that are in favorite tab of inventory (ZC_ITEM_FAVORITE).
@@ -18092,8 +18092,8 @@ bool clif_parse_roulette_db(void) {
}
}
- libconfig->destroy(&roulette_conf);
}
+ libconfig->destroy(&roulette_conf);
for(i = 0; i < MAX_ROULETTE_LEVEL; i++) {
int limit = MAX_ROULETTE_COLUMNS-i;
diff --git a/src/map/map.c b/src/map/map.c
index a7b171ddf..6e35e6bb6 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -5273,8 +5273,6 @@ void read_map_zone_db(void) {
}
ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' zones in '"CL_WHITE"%s"CL_RESET"'.\n", zone_count, config_filename);
- /* not supposed to go in here but in skill_final whatever */
- libconfig->destroy(&map_zone_db);
/* post-load processing */
if( (zone = strdb_get(map->zone_db, MAP_ZONE_PVP_NAME)) )
@@ -5284,6 +5282,8 @@ void read_map_zone_db(void) {
if( (zone = strdb_get(map->zone_db, MAP_ZONE_BG_NAME)) )
zone->info.special = 1;
}
+ /* not supposed to go in here but in skill_final whatever */
+ libconfig->destroy(&map_zone_db);
}
int map_get_new_bonus_id (void) {
diff --git a/src/map/quest.c b/src/map/quest.c
index ddbd2f92d..fe4014ae5 100644
--- a/src/map/quest.c
+++ b/src/map/quest.c
@@ -529,6 +529,7 @@ int quest_read_db(void)
count++;
}
+ libconfig->destroy(&quest_db_conf);
ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", count, filename);
return count;
}
diff --git a/src/map/script.c b/src/map/script.c
index 3e6fb2c47..dc0edcb01 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -4719,6 +4719,7 @@ void script_load_translations(void) {
script->load_translation(translation_file, ++lang_id, &total);
}
+ libconfig->destroy(&translations_conf);
if( total ) {
DBIterator *main_iter;