diff options
author | Harald Welte <laforge@osmocom.org> | 2020-07-15 12:21:29 +0200 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2020-07-15 12:23:46 +0200 |
commit | bebec218a708045f30763e975c6041e44f766b60 (patch) | |
tree | ea63bbf604739ada464f789932b3bdc88cebc377 | |
parent | 9b35e56e5616a4d96db94c9f5071c36dc3d26a6d (diff) |
vty: Avoid ultra-long multi-line strings cluttering talloc reports
The talloc_asprintf() series includes an unconditional call to
talloc_set_name_const(), turning the entire long constructed string
into the name of the talloc object. That simply doesn't work when
creating kilobytes-sized VTY reference strings including linefeeds.
Let's add an explicit talloc_set_name_const() to prevent this.
Change-Id: Ibd77684b88cc3572047daa98c9a6b9119fba041b
Closes: OS#4668
-rw-r--r-- | src/vty/logging_vty.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c index c51b4373..0e1782a4 100644 --- a/src/vty/logging_vty.c +++ b/src/vty/logging_vty.c @@ -337,6 +337,9 @@ static void gen_logging_level_cmd_strs(struct cmd_element *cmd, osmo_talloc_asprintf(tall_log_ctx, cmd_str, ") %s", level_args); osmo_talloc_asprintf(tall_log_ctx, doc_str, "%s", level_strs); + talloc_set_name_const(cmd_str, "vty_log_level_cmd_str"); + talloc_set_name_const(doc_str, "vty_log_level_doc_str"); + cmd->string = cmd_str; cmd->doc = doc_str; } @@ -1048,6 +1051,9 @@ static void gen_vty_logp_cmd_strs(struct cmd_element *cmd) osmo_talloc_asprintf(tall_log_ctx, doc_str, "Arbitrary message to log on given category and log level\n"); + talloc_set_name_const(cmd_str, "vty_logp_cmd_str"); + talloc_set_name_const(doc_str, "vty_logp_doc_str"); + cmd->string = cmd_str; cmd->doc = doc_str; } |