Free info->name on demand
This commit is contained in:
@ -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);
|
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 = (TCGHelperInfo *)p;
|
||||||
TCGHelperInfo* info = g_hash_table_lookup(helper_table, hk->callback);
|
|
||||||
|
|
||||||
if (info) {
|
g_free((void*)(info->name));
|
||||||
g_hash_table_remove(helper_table, info);
|
|
||||||
|
|
||||||
g_free((gpointer)info->name);
|
|
||||||
g_free(info);
|
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)
|
void tcg_context_init(TCGContext *s)
|
||||||
{
|
{
|
||||||
@ -754,7 +753,7 @@ void tcg_context_init(TCGContext *s)
|
|||||||
s->helper_table = helper_table;
|
s->helper_table = helper_table;
|
||||||
|
|
||||||
// Unicorn: Store our custom inline hooks infomation
|
// 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) {
|
for (i = 0; i < ARRAY_SIZE(all_helpers); ++i) {
|
||||||
g_hash_table_insert(helper_table, (gpointer)all_helpers[i].func,
|
g_hash_table_insert(helper_table, (gpointer)all_helpers[i].func,
|
||||||
|
Reference in New Issue
Block a user