Fix some more memleaks in disasm and fix issue in str overlap

This commit is contained in:
pancake 2018-03-14 16:07:30 +01:00
parent 18f805d296
commit a902df837b
2 changed files with 13 additions and 4 deletions

View File

@ -4292,6 +4292,9 @@ toro:
ds->vat = p2v (ds, ds->at);
if (r_cons_is_breaked ()) {
dorepeat = 0;
ds_print_esil_anal_fini (ds);
ds_reflines_fini (ds);
ds_free (ds);
R_FREE (nbuf);
r_cons_break_pop ();
return 0; //break;
@ -4311,6 +4314,7 @@ toro:
if (ds_must_strip (ds)) {
inc = ds->analop.size;
// inc = ds->asmop.payload + (ds->asmop.payload % ds->core->assembler->dataalign);
r_anal_op_fini (&ds->analop);
continue;
}
// f = r_anal_get_fcn_in (core->anal, ds->at, R_ANAL_FCN_TYPE_NULL);
@ -4340,6 +4344,7 @@ toro:
if (len == l) {
break;
}
r_anal_op_fini (&ds->analop);
continue;
} else {
ds->lines--;
@ -4347,6 +4352,7 @@ toro:
r_io_read_at (core->io, ds->addr, buf, len);
inc = 0; //delta;
idx = 0;
r_anal_op_fini (&ds->analop);
continue;
}
}
@ -4361,6 +4367,7 @@ toro:
r_core_cmdf (core, "pf %s @ 0x%08"PFMT64x"\n", fmt, ds->addr + idx);
inc += r_anal_type_get_size (core->anal, link_type) / 8;
free (fmt);
r_anal_op_fini (&ds->analop);
continue;
}
} else {

View File

@ -1,4 +1,4 @@
/* radare2 - LGPL - Copyright 2009-2017 - nibble, pancake, maijin */
/* radare2 - LGPL - Copyright 2009-2018 - nibble, pancake, maijin */
#include <stdio.h>
@ -206,11 +206,11 @@ static int filter(RParse *p, RFlag *f, char *data, char *str, int len, bool big_
#endif
ptr = nptr;
if (x86) {
for (ptr2 = ptr; *ptr2 && (*ptr2 != ']' && (*ptr2 != '\x1b') && !ISSEPARATOR (*ptr2)); ptr2++);
} else {
for (ptr2 = ptr; *ptr2 && !isx86separator (*ptr2); ptr2++) {
// eprintf ("(%s) (%c)\n", optr, *ptr2);
}
} else {
for (ptr2 = ptr; *ptr2 && (*ptr2 != ']' && (*ptr2 != '\x1b') && !ISSEPARATOR (*ptr2)); ptr2++);
}
off = r_num_math (NULL, ptr);
if (off >= p->minval) {
@ -314,9 +314,11 @@ static int filter(RParse *p, RFlag *f, char *data, char *str, int len, bool big_
break;
}
memmove (ptr_left, ptr_esc, copied_len);
sprintf (ptr_left + copied_len, "%s%s",
char *rest = r_str_newf ("%s%s",
ansi_found && ptr_right - ptr_end + 1 >= 4 ? "\x1b[0m" : "",
ptr_right + 1);
strcpy (ptr_left + copied_len, rest);
free (rest);
}
break;
}