char *reply, int *len, struct wayland_tbm_client *tbm_client)
{
struct wayland_tbm_monitor_path path = {0};
- char show_str[1024*4] = {0,};
- int show_len = sizeof(show_str);
+ char *show_str;
_wayland_tbm_util_show_path_parse(argv[2], 0, &path);
tbm_bufmgr_debug_show(tbm_client->bufmgr);
/* we have to save result to some file as reply can be very long */
- tbm_bufmgr_debug_tbm_info_get(tbm_client->bufmgr, show_str, &show_len);
- _waylend_tbm_monitor_client_print_show_to_file(show_str);
+ show_str = tbm_bufmgr_debug_tbm_info_get(tbm_client->bufmgr);
+ if (show_str) {
+ _waylend_tbm_monitor_client_print_show_to_file(show_str);
+ free(show_str);
+ }
+
/* send empty string to close the session */
WL_TBM_MONITOR_SNPRINTF(reply, *len, "\n");
_waylend_tbm_monitor_server_show(struct wayland_tbm_monitore_request *r)
{
struct wayland_tbm_monitor_target target = {0};
- FILE * f = NULL;
- char show_str[1024*4] = {0,};
- int len = sizeof(show_str);
+ FILE *f = NULL;
+ char *show_str;
if (!_waylend_tbm_util_target_parse(r->argv[1], &target)) {
_wayland_tbm_monitor_request_printf(r, "'%s' - unknown target for -show\n", r->argv[1]);
}
if (target.server) {
- tbm_bufmgr_debug_tbm_info_get(r->tbm_srv->bufmgr, show_str, &len);
+ show_str = tbm_bufmgr_debug_tbm_info_get(r->tbm_srv->bufmgr);
+ WL_TBM_RETURN_IF_FAIL(show_str);
if (r->path.console && r->console)
fprintf(r->console, "%s", show_str);
r->path.file);
}
+ free(show_str);
+
if (r->path.dlog)
tbm_bufmgr_debug_show(r->tbm_srv->bufmgr);
}