diff options
author | gepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-03-02 00:22:18 +0000 |
---|---|---|
committer | gepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-03-02 00:22:18 +0000 |
commit | 617841dc1c79d7a7b48496c81bf934cb3fd5952b (patch) | |
tree | 15888b0aefd3cca592a24bec670d4fbe30c65207 /src/map | |
parent | 9a811dca20817abc586a67330d42797ee118c1cf (diff) | |
download | hercules-617841dc1c79d7a7b48496c81bf934cb3fd5952b.tar.gz hercules-617841dc1c79d7a7b48496c81bf934cb3fd5952b.tar.bz2 hercules-617841dc1c79d7a7b48496c81bf934cb3fd5952b.tar.xz hercules-617841dc1c79d7a7b48496c81bf934cb3fd5952b.zip |
- Fixed dangling pointer caused by r15644 (partially reverted).
- Fixed possible memory leaks with guild castle script events.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15647 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/guild.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/map/guild.c b/src/map/guild.c index 5a5f72ea4..21a606394 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -1914,6 +1914,18 @@ bool guild_isallied(int guild_id, int guild_id2) return( i < MAX_GUILDALLIANCE && g->alliance[i].opposition == 0 ); } +static int eventlist_db_final(DBKey key,void *data,va_list ap) +{ + struct eventlist *next = NULL; + struct eventlist *current = data; + while (current != NULL) { + next = current->next; + aFree(current); + current = next; + } + return 0; +} + static int guild_expcache_db_final(DBKey key,void *data,va_list ap) { ers_free(expcache_ers, data); @@ -1934,9 +1946,9 @@ void do_init_guild(void) guild_db=idb_alloc(DB_OPT_RELEASE_DATA); castle_db=idb_alloc(DB_OPT_BASE); guild_expcache_db=idb_alloc(DB_OPT_BASE); - guild_infoevent_db=idb_alloc(DB_OPT_BASE|DB_OPT_RELEASE_DATA); + guild_infoevent_db=idb_alloc(DB_OPT_BASE); expcache_ers = ers_new(sizeof(struct guild_expcache)); - guild_castleinfoevent_db=idb_alloc(DB_OPT_BASE|DB_OPT_RELEASE_DATA); + guild_castleinfoevent_db=idb_alloc(DB_OPT_BASE); sv_readdb(db_path, "castle_db.txt", ',', 4, 5, -1, &guild_read_castledb); @@ -1954,7 +1966,7 @@ void do_final_guild(void) db_destroy(guild_db); castle_db->destroy(castle_db,guild_castle_db_final); guild_expcache_db->destroy(guild_expcache_db,guild_expcache_db_final); - db_destroy(guild_infoevent_db); - db_destroy(guild_castleinfoevent_db); + guild_infoevent_db->destroy(guild_infoevent_db,eventlist_db_final); + guild_castleinfoevent_db->destroy(guild_castleinfoevent_db,eventlist_db_final); ers_destroy(expcache_ers); } |