Fix last covs (leak regression in visual)

This commit is contained in:
pancake 2018-12-31 11:27:46 +01:00
parent b29f5bb54a
commit ad9f108926
2 changed files with 10 additions and 7 deletions

View File

@ -3528,8 +3528,10 @@ R_API void r_core_visual_title(RCore *core, int color) {
if (tabsCount > 0) { if (tabsCount > 0) {
const char *kolor = core->cons->pal.prompt; const char *kolor = core->cons->pal.prompt;
char *tabstring = visual_tabstring (core, kolor); char *tabstring = visual_tabstring (core, kolor);
title = r_str_append (title, tabstring); if (tabstrings) {
free (tabstring); title = r_str_append (title, tabstring);
free (tabstring);
}
#if 0 #if 0
// TODO: add an option to show this tab mode instead? // TODO: add an option to show this tab mode instead?
const int curTab = core->visual.tab; const int curTab = core->visual.tab;
@ -3548,6 +3550,7 @@ R_API void r_core_visual_title(RCore *core, int color) {
} }
r_cons_print (title); r_cons_print (title);
free (title); free (title);
free (address);
} }
if (color) { if (color) {
r_cons_strcat (Color_RESET); r_cons_strcat (Color_RESET);

View File

@ -402,7 +402,7 @@ R_API void r_print_addr(RPrint *p, ut64 addr) {
if (use_segoff) { if (use_segoff) {
ut32 s, a; ut32 s, a;
a = addr & 0xffff; a = addr & 0xffff;
s = (addr - a) >> p->seggrn; s = (addr - a) >> (p? p->seggrn: 0);
if (dec) { if (dec) {
snprintf (space, sizeof (space), "%d:%d", s & 0xffff, a & 0xffff); snprintf (space, sizeof (space), "%d:%d", s & 0xffff, a & 0xffff);
white = r_str_pad (' ', 9 - strlen (space)); white = r_str_pad (' ', 9 - strlen (space));
@ -431,9 +431,9 @@ R_API void r_print_addr(RPrint *p, ut64 addr) {
if (use_color) { if (use_color) {
const char *pre = PREOFF (offset): Color_GREEN; const char *pre = PREOFF (offset): Color_GREEN;
const char *fin = Color_RESET; const char *fin = Color_RESET;
if (p->flags & R_PRINT_FLAGS_RAINBOW) { if (p && p->flags & R_PRINT_FLAGS_RAINBOW) {
// pre = r_cons_rgb_str_off (rgbstr, addr); // pre = r_cons_rgb_str_off (rgbstr, addr);
if (p && p->cons && p->cons->rgbstr) { if (p->cons && p->cons->rgbstr) {
static char rgbstr[32]; static char rgbstr[32];
pre = p->cons->rgbstr (rgbstr, sizeof (rgbstr), addr); pre = p->cons->rgbstr (rgbstr, sizeof (rgbstr), addr);
} }
@ -441,7 +441,7 @@ R_API void r_print_addr(RPrint *p, ut64 addr) {
if (dec) { if (dec) {
printfmt ("%s%s%" PFMT64d "%s%c", pre, white, addr, fin, ch); printfmt ("%s%s%" PFMT64d "%s%c", pre, white, addr, fin, ch);
} else { } else {
if (p->wide_offsets) { if (p && p->wide_offsets) {
// TODO: make %016 depend on asm.bits // TODO: make %016 depend on asm.bits
printfmt ("%s0x%016" PFMT64x "%s%c", pre, addr, fin, ch); printfmt ("%s0x%016" PFMT64x "%s%c", pre, addr, fin, ch);
} else { } else {
@ -452,7 +452,7 @@ R_API void r_print_addr(RPrint *p, ut64 addr) {
if (dec) { if (dec) {
printfmt ("%s%" PFMT64d "%c", white, addr, ch); printfmt ("%s%" PFMT64d "%c", white, addr, ch);
} else { } else {
if (p->wide_offsets) { if (p && p->wide_offsets) {
// TODO: make %016 depend on asm.bits // TODO: make %016 depend on asm.bits
printfmt ("0x%016" PFMT64x "%c", addr, ch); printfmt ("0x%016" PFMT64x "%c", addr, ch);
} else { } else {