summaryrefslogtreecommitdiff
path: root/src/char/int_storage.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-05-29 22:21:59 +0300
committerAndrei Karas <akaras@inbox.ru>2017-05-29 22:37:40 +0300
commit50848cc7f79aa516351e4a4d673df53f4881eb4d (patch)
treeb984fabb9019b7ca4549f1ab45c64a766160cf7c /src/char/int_storage.c
parentcb3e2f5f3b91d0a1f7711eff9c10ae9a655a74f2 (diff)
downloadhercules-50848cc7f79aa516351e4a4d673df53f4881eb4d.tar.gz
hercules-50848cc7f79aa516351e4a4d673df53f4881eb4d.tar.bz2
hercules-50848cc7f79aa516351e4a4d673df53f4881eb4d.tar.xz
hercules-50848cc7f79aa516351e4a4d673df53f4881eb4d.zip
Fix memory leak in storage item vector (Fixes #1751)
Diffstat (limited to 'src/char/int_storage.c')
-rw-r--r--src/char/int_storage.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/char/int_storage.c b/src/char/int_storage.c
index 5f005005e..d5e5389c7 100644
--- a/src/char/int_storage.c
+++ b/src/char/int_storage.c
@@ -365,6 +365,19 @@ int inter_storage_guild_storage_delete(int guild_id)
return 0;
}
+/**
+ * Delete storage from memory for given account_id.
+ * @param account_id [in] account id
+ */
+void inter_storage_delete_account_storage(int account_id)
+{
+ struct storage_data *stor = (struct storage_data *)idb_get(inter_storage->account_storage, account_id);
+ if (stor == NULL)
+ return;
+ VECTOR_CLEAR(stor->item);
+ idb_remove(inter_storage->account_storage, account_id);
+}
+
//---------------------------------------------------------
// packet from map server
@@ -792,6 +805,7 @@ void inter_storage_defaults(void)
inter_storage->sql_init = inter_storage_sql_init;
inter_storage->sql_final = inter_storage_sql_final;
inter_storage->delete_ = inter_storage_delete;
+ inter_storage->delete_account_storage = inter_storage_delete_account_storage;
inter_storage->guild_storage_delete = inter_storage_guild_storage_delete;
inter_storage->parse_frommap = inter_storage_parse_frommap;
}