Fix memory leaks as reported by DrMemory and Valgrind.

ARM and probably the rest of the arches have significant memory leaks as
they have no release interface.

Additionally, DrMemory does not have 64-bit support and thus I can't
test the 64-bit version under Windows. Under Linux valgrind supports
both 32-bit and 64-bit but there are different macros and code for Linux
and Windows.
This commit is contained in:
farmdve
2016-01-08 01:41:45 +02:00
parent 13726b3d40
commit 036763d6ae
22 changed files with 85 additions and 45 deletions

8
uc.c
View File

@@ -263,9 +263,7 @@ uc_err uc_close(uc_engine *uc)
if (uc->release)
uc->release(uc->tcg_ctx);
#ifndef _WIN32
free(uc->l1_map);
#endif
if (uc->bounce.buffer) {
free(uc->bounce.buffer);
@@ -273,8 +271,6 @@ uc_err uc_close(uc_engine *uc)
g_free(uc->tcg_ctx);
free((void*) uc->system_memory->name);
g_free(uc->system_memory);
g_hash_table_destroy(uc->type_table);
for (i = 0; i < DIRTY_MEMORY_NUM; i++) {
@@ -282,7 +278,7 @@ uc_err uc_close(uc_engine *uc)
}
// TODO: remove uc->root (created with object_new())
uc->root->free(uc->root);
//uc->root->free(uc->root);
free(uc->hook_callbacks);
@@ -524,7 +520,7 @@ uc_err uc_emu_start(uc_engine* uc, uint64_t begin, uint64_t until, uint64_t time
if (timeout) {
// wait for the timer to finish
qemu_thread_join(&uc->timer);
qemu_thread_join(uc, &uc->timer);
}
return uc->invalid_error;