mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-21 10:44:16 +00:00
add switch_hashtable_insert_destructor so you can insert a pointer into a hash with a custom destructor and use it in spandsp to fix a leak on reloadxml with the tone_descriptor tables and fix a bunch of random tiny leaks etc
This commit is contained in:
1 parent
d789c6470a
commit
4178688b4a
12 files changed
+56
-37
No files matched your search
@@ -55,9 +55,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_destroy(switch_hash_t **hash)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert(switch_hash_t *hash, const char *key, const void *data)
|
||||
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_destructor(switch_hash_t *hash, const char *key, const void *data, hashtable_destructor_t destructor)
|
||||
{
|
||||
switch_hashtable_insert(hash, strdup(key), (void *)data, HASHTABLE_FLAG_FREE_KEY);
|
||||
switch_hashtable_insert_destructor(hash, strdup(key), (void *)data, HASHTABLE_FLAG_FREE_KEY, destructor);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user