Fix ownership of RzConsCanvas when used by RzAGraph (#6231)

This commit is contained in:
Giovanni 2026-04-14 16:55:09 +08:00 committed by GitHub
parent cf39746a03
commit 2fd5912834
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View file

@ -148,8 +148,7 @@ RZ_API void rz_cons_canvas_free(RzConsCanvas *c) {
return;
}
if (c->b) {
int y;
for (y = 0; y < c->h; y++) {
for (int y = 0; y < c->h; y++) {
free(c->b[y]);
}
free(c->b);

View file

@ -2520,6 +2520,8 @@ RZ_IPI RzCmdStatus rz_cmd_heap_chunks_print_handler(RzCore *core, int argc, cons
rz_config_hold_free(hc);
return RZ_CMD_STATUS_ERROR;
}
// RzConsCanvas is now owned by RzAGraph
can = NULL;
RzANode *top = RZ_EMPTY, *chunk_node = RZ_EMPTY, *prev_node = RZ_EMPTY;
char *top_title = NULL, *top_data = NULL, *node_title = NULL, *node_data = NULL;
bool first_node = true;
@ -2536,8 +2538,8 @@ RZ_IPI RzCmdStatus rz_cmd_heap_chunks_print_handler(RzCore *core, int argc, cons
PRINTF_YA("0x%" PFMT64x, (ut64)m_state);
rz_cons_newline();
} else if (mode == RZ_OUTPUT_MODE_LONG_JSON) {
can->linemode = rz_config_get_i(core->config, "graph.linemode");
can->color = rz_config_get_i(core->config, "scr.color");
g->can->linemode = rz_config_get_i(core->config, "graph.linemode");
g->can->color = rz_config_get_i(core->config, "scr.color");
core->cons->use_utf8 = rz_config_get_i(core->config, "scr.utf8");
g->layout = rz_config_get_i(core->config, "graph.layout");
rz_agraph_set_title(g, "Heap Layout");