Free info->name on demand
This commit is contained in:
parent
55b4865945
commit
5f89981a3c
|
@ -697,19 +697,18 @@ void uc_add_inline_hook(uc_engine *uc, struct hook *hk, void** args, int args_le
|
|||
tcg_gen_callN(tcg_ctx, info->func, NULL, args_len, (TCGTemp**)args);
|
||||
}
|
||||
|
||||
void uc_del_inline_hook(uc_engine *uc, struct hook *hk)
|
||||
static void uc_free_inline_hook_info(void *p)
|
||||
{
|
||||
GHashTable *helper_table = uc->tcg_ctx->helper_table;
|
||||
TCGHelperInfo* info = g_hash_table_lookup(helper_table, hk->callback);
|
||||
TCGHelperInfo *info = (TCGHelperInfo *)p;
|
||||
|
||||
if (info) {
|
||||
g_hash_table_remove(helper_table, info);
|
||||
|
||||
g_free((gpointer)info->name);
|
||||
g_free(info);
|
||||
}
|
||||
g_free((void*)(info->name));
|
||||
g_free(info);
|
||||
}
|
||||
|
||||
void uc_del_inline_hook(uc_engine *uc, struct hook *hk)
|
||||
{
|
||||
g_hash_table_remove(uc->tcg_ctx->custom_helper_infos, hk->callback);
|
||||
}
|
||||
|
||||
void tcg_context_init(TCGContext *s)
|
||||
{
|
||||
|
@ -754,7 +753,7 @@ void tcg_context_init(TCGContext *s)
|
|||
s->helper_table = helper_table;
|
||||
|
||||
// Unicorn: Store our custom inline hooks infomation
|
||||
s->custom_helper_infos = g_hash_table_new_full(NULL, NULL, NULL, g_free);
|
||||
s->custom_helper_infos = g_hash_table_new_full(NULL, NULL, NULL, uc_free_inline_hook_info);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(all_helpers); ++i) {
|
||||
g_hash_table_insert(helper_table, (gpointer)all_helpers[i].func,
|
||||
|
|
Loading…
Reference in New Issue