FS-12038: [mod_sofia, core] Fix potential leak and race in chat_hash, add switch_core_hash_insert_auto_free().

This commit is contained in:
Andrey Volk
2019-09-06 17:02:52 +04:00
parent d0c6b30c15
commit 20a893fd06
5 changed files with 26 additions and 13 deletions
+10
View File
@@ -1424,6 +1424,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_init_case(_Out_ switch_hash_t *
*/
SWITCH_DECLARE(switch_status_t) switch_core_hash_destroy(_Inout_ switch_hash_t **hash);
/*!
\brief Insert data into a hash and set flags so the value is automatically freed on delete
\param hash the hash to add data to
\param key the name of the key to add the data to
\param data the data to add
\return SWITCH_STATUS_SUCCESS if the data is added
\note the string key must be a constant or a dynamic string
*/
SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_auto_free(switch_hash_t *hash, const char *key, const void *data);
/*!
\brief Insert data into a hash
\param hash the hash to add data to