Fix memleak in mac debugger and regression in asm.immstr

This commit is contained in:
pancake 2017-11-04 20:22:14 +01:00
parent 06b2b32dc0
commit 1f70a7ece8
4 changed files with 14 additions and 8 deletions

View file

@ -2791,15 +2791,15 @@ static void ds_print_ptr(RDisasmState *ds, int len, int idx) {
}
ds->chref = 0;
if ((char)v > 0 && (char)v >= '!' && (char)v <= '~') {
if ((char)v > 0 && v >= '!' && v <= '~') {
ds->chref = (char)v;
ALIGN;
if (!ds->immstr) {
ds_comment (ds, true, "; '%c'%s", (char)v, nl);
} else {
if (ds->immstr) {
char *str = r_str_from_ut64 (r_read_ble64(&v, core->print->big_endian));
ds_comment (ds, true, "; '%s'%s", str, nl);
free (str);
} else {
ds_comment (ds, true, "; '%c'%s", (char)v, nl);
}
}
RList *list = NULL;

View file

@ -791,8 +791,9 @@ static int bsd_reg_read (RDebug *dbg, int type, ut8* buf, int size) {
// TODO: what about float and hardware regs here ???
// TODO: add flag for type
static int r_debug_native_reg_read (RDebug *dbg, int type, ut8 *buf, int size) {
if (size < 1)
if (size < 1) {
return false;
}
#if __WINDOWS__ && !__CYGWIN__
return w32_reg_read (dbg, type, buf, size);
#elif __APPLE__

View file

@ -300,7 +300,7 @@ int xnu_continue(RDebug *dbg, int pid, int tid, int sig) {
return false;
}
//TODO free refs count threads
xnu_thread_t *th = get_xnu_thread (dbg, getcurthread (dbg));
xnu_thread_t *th = get_xnu_thread (dbg, getcurthread (dbg));
if (!th) {
eprintf ("failed to get thread in xnu_continue\n");
return false;

View file

@ -257,9 +257,12 @@ static bool xnu_fill_info_thread (RDebug *dbg, xnu_thread_t *thread) {
static xnu_thread_t *xnu_get_thread_with_info (RDebug *dbg, thread_t port) {
xnu_thread_t *thread = R_NEW0 (xnu_thread_t);
if (!thread) return NULL;
if (!thread) {
return NULL;
}
thread->port = port;
if (!xnu_fill_info_thread (dbg, thread)) {
free (thread->name);
thread->name = strdup ("unknown");
}
return thread;
@ -297,7 +300,9 @@ static int xnu_update_thread_list (RDebug *dbg) {
// ok we have the list that will hold our threads, now is time to get
// them
task = pid_to_task (dbg->pid);
if (!task) return false;
if (!task) {
return false;
}
kr = task_threads (task, &thread_list, &thread_count);
if (kr != KERN_SUCCESS) {
// we can get into this when the process has terminated but we