free spellbooks correctly.

This commit is contained in:
Enno Rehling 2014-12-31 01:38:49 +01:00
parent e9c3a00f7d
commit 6abe180f68
1 changed files with 9 additions and 0 deletions

View File

@ -2979,7 +2979,16 @@ spellbook * get_spellbook(const char * name)
return result; return result;
} }
int free_spellbook_cb(const void *match, const void *key, size_t keylen, void *data) {
spellbook *sb;
cb_get_kv(match, &sb, sizeof(sb));
spellbook_clear(sb);
free(sb);
return 0;
}
void free_spellbooks(void) void free_spellbooks(void)
{ {
cb_foreach(&cb_spellbooks, "", 0, free_spellbook_cb, NULL);
cb_clear(&cb_spellbooks); cb_clear(&cb_spellbooks);
} }