Fix another memleak in xnu's debugger

This commit is contained in:
pancake 2017-11-04 20:42:38 +01:00
parent 1f70a7ece8
commit 5b8eaa4a56
2 changed files with 5 additions and 16 deletions

View file

@ -540,13 +540,6 @@ static vm_prot_t unix_prot_to_darwin(int prot) {
int xnu_map_protect (RDebug *dbg, ut64 addr, int size, int perms) {
int ret;
task_t task = pid_to_task (dbg->tid);
// TODO: align pointers
#if 0
xnu_thread_t *th = get_xnu_thread (dbg, dbg->tid);
if (!th) {
return false;
}
#endif
#define xwr2rwx(x) ((x&1)<<2) | (x&2) | ((x&4)>>2)
int xnu_perms = xwr2rwx (perms);
ret = mach_vm_protect (task, (vm_address_t)addr, (vm_size_t)size, (boolean_t)0, xnu_perms); //VM_PROT_COPY | perms);

View file

@ -224,9 +224,8 @@ static bool xnu_fill_info_thread (RDebug *dbg, xnu_thread_t *thread) {
#endif
mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT;
thread_identifier_info_data_t identifier_info;
kern_return_t kr =
thread_info (thread->port, THREAD_BASIC_INFO,
(thread_info_t)&thread->basic_info, &count);
kern_return_t kr = thread_info (thread->port, THREAD_BASIC_INFO,
(thread_info_t)&thread->basic_info, &count);
if (kr != KERN_SUCCESS) {
eprintf ("Fail to get thread_basic_info\n");
return false;
@ -238,6 +237,7 @@ static bool xnu_fill_info_thread (RDebug *dbg, xnu_thread_t *thread) {
eprintf ("Fail to get thread_identifier_info\n");
return false;
}
R_FREE (thread->name);
#if TARGET_OS_IPHONE
// TODO proc_pidinfo here
thread->name = strdup ("unknown");
@ -366,12 +366,8 @@ static int xnu_update_thread_list (RDebug *dbg) {
}
}
// once that is over we need to free the buffer
kr = vm_deallocate (mach_task_self (), (mach_vm_address_t)thread_list,
thread_count * sizeof (thread_t));
if (kr != KERN_SUCCESS) {
eprintf ("error: vm_deallocate xnu_update_thread_list\n");
return false;
}
(void)vm_deallocate (mach_task_self (), (mach_vm_address_t)thread_list,
thread_count * sizeof (thread_t));
return true;
}
#endif