fixed leaks in test cases (#1247)

This commit is contained in:
Dominik Maier 2020-05-02 12:18:18 +02:00 committed by GitHub
parent 1ad541cd55
commit 9fedbd96f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 6 additions and 0 deletions

View File

@ -301,6 +301,7 @@ static void test_i386_map_ptr(void)
printf(">>> Failed to read 4 bytes from [0x%x]\n", ADDRESS); printf(">>> Failed to read 4 bytes from [0x%x]\n", ADDRESS);
uc_close(uc); uc_close(uc);
free(mem);
} }
static void test_i386_jump(void) static void test_i386_jump(void)

View File

@ -280,6 +280,7 @@ static void gdt_demo()
assert(memcmp(buf, "\x67\x45\x23\x01\xef\xcd\xab\x89", 8) == 0); assert(memcmp(buf, "\x67\x45\x23\x01\xef\xcd\xab\x89", 8) == 0);
uc_close(uc); uc_close(uc);
free(gdt);
} }
/******************************************************************************/ /******************************************************************************/

View File

@ -27,5 +27,6 @@ int main()
uc_mem_write (uc, UC_BUG_WRITE_ADDR, buf, size); uc_mem_write (uc, UC_BUG_WRITE_ADDR, buf, size);
} }
uc_close(uc); uc_close(uc);
free(buf);
return 0; return 0;
} }

View File

@ -41,6 +41,7 @@ int main()
uc_hook_add(uc, &uh_trap, UC_HOOK_INTR, _interrupt, NULL, 1, 0); uc_hook_add(uc, &uh_trap, UC_HOOK_INTR, _interrupt, NULL, 1, 0);
uc_emu_start(uc, UC_BUG_WRITE_ADDR, UC_BUG_WRITE_ADDR+8, 0, 1); uc_emu_start(uc, UC_BUG_WRITE_ADDR, UC_BUG_WRITE_ADDR+8, 0, 1);
uc_close(uc); uc_close(uc);
free(buf);
printf ("Correct: %s\n", got_sigill? "YES": "NO"); printf ("Correct: %s\n", got_sigill? "YES": "NO");
return got_sigill? 0: 1; return got_sigill? 0: 1;
} }

BIN
tests/regress/x86_vex Executable file

Binary file not shown.

View File

@ -63,6 +63,8 @@ static void test_basic(void **state)
uc_assert_success(uc_mem_unmap(uc, mem_start, mem_len)); uc_assert_success(uc_mem_unmap(uc, mem_start, mem_len));
assert_memory_equal(buf, host_mem, 4); assert_memory_equal(buf, host_mem, 4);
free(host_mem);
} }
int main(void) { int main(void) {