提交 954b276c authored 作者: Anthony Minessale's avatar Anthony Minessale

use malloc in hashes when no pool specified

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15070 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 f04b5b90
......@@ -444,6 +444,7 @@ void sofia_glue_tech_prepare_codecs(private_object_t *tech_pvt)
}
}
if (codec_string) {
char *tmp_codec_string;
if ((tmp_codec_string = switch_core_session_strdup(tech_pvt->session, codec_string))) {
......
......@@ -39,18 +39,25 @@
struct switch_hash {
Hash table;
switch_memory_pool_t *pool;
};
SWITCH_DECLARE(switch_status_t) switch_core_hash_init_case(switch_hash_t **hash, switch_memory_pool_t *pool, switch_bool_t case_sensitive)
{
switch_hash_t *newhash;
newhash = switch_core_alloc(pool, sizeof(*newhash));
if (pool) {
newhash = switch_core_alloc(pool, sizeof(*newhash));
newhash->pool = pool;
} else {
switch_zmalloc(newhash, sizeof(*newhash));
}
switch_assert(newhash);
sqlite3HashInit(&newhash->table, case_sensitive ? SQLITE_HASH_BINARY : SQLITE_HASH_STRING, 1);
*hash = newhash;
return SWITCH_STATUS_SUCCESS;
}
......@@ -58,7 +65,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_hash_destroy(switch_hash_t **hash)
{
switch_assert(hash != NULL && *hash != NULL);
sqlite3HashClear(&(*hash)->table);
if (!(*hash)->pool) {
free(*hash);
}
*hash = NULL;
return SWITCH_STATUS_SUCCESS;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论