Skip to content

Commit

Permalink
visual: fix memory-related issues in calculating file percentage (riz…
Browse files Browse the repository at this point in the history
  • Loading branch information
PeiweiHu authored Jun 6, 2024
1 parent 51bd32c commit 6294e91
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions librz/core/tui/visual.c
Original file line number Diff line number Diff line change
Expand Up @@ -3564,10 +3564,10 @@ static RZ_OWN char *screen_bottom_address(RzCore *core) {

char *rtn = NULL;
// get the line at the bottom of the screen
if (!core->cons->lastline) {
if (!core->cons->context->buffer) {
return NULL;
}
char *output = strdup(core->cons->lastline);
char *output = strdup(core->cons->context->buffer);
size_t line_count = 0, *line_index = rz_str_split_lines(output, &line_count);
int rows;
rz_cons_get_size(&rows);
Expand Down Expand Up @@ -3606,6 +3606,7 @@ static RZ_OWN char *screen_bottom_address(RzCore *core) {
memmove(rtn + 2, rtn, addr_len);
rtn[0] = '0';
rtn[1] = 'x';
rtn[prefix_len + addr_len] = '\0';
}

exit:
Expand Down

0 comments on commit 6294e91

Please sign in to comment.