From 1dbe1a33b4a3f9651e90750db367ced914e19b1b Mon Sep 17 00:00:00 2001 From: Michael Vetter Date: Thu, 9 Sep 2021 09:53:23 +0200 Subject: cmd_funcs: Use glib function --- src/command/cmd_funcs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c index 96b541b8..ad1b3331 100644 --- a/src/command/cmd_funcs.c +++ b/src/command/cmd_funcs.c @@ -1651,8 +1651,7 @@ cmd_help(ProfWin* window, const char* const command, gchar** args) cons_navigation_help(); } else { char* cmd = args[0]; - char cmd_with_slash[1 + strlen(cmd) + 1]; - sprintf(cmd_with_slash, "/%s", cmd); + char *cmd_with_slash = g_strdup_printf("/%s", cmd); Command* command = cmd_get(cmd_with_slash); if (command) { @@ -1666,6 +1665,7 @@ cmd_help(ProfWin* window, const char* const command, gchar** args) } } cons_show(""); + g_free(cmd_with_slash); } return TRUE; -- cgit 1.4.1-2-gfad0