1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-05 01:03:14 +02:00

trigger: replace calls to malloc by weechat_asprintf

This commit is contained in:
Sébastien Helleu
2024-12-17 21:06:05 +01:00
parent ce2c4b74a2
commit 3b88065266
3 changed files with 18 additions and 34 deletions
+5 -10
View File
@@ -307,17 +307,12 @@ trigger_completion_add_quoted_word (struct t_gui_completion *completion,
const char *word)
{
char *temp;
int length;
length = 1 + strlen (word) + 1 + 1;
temp = malloc (length);
if (!temp)
return;
snprintf (temp, length, "\"%s\"", word);
weechat_completion_list_add (completion, temp, 0, WEECHAT_LIST_POS_END);
free (temp);
if (weechat_asprintf (&temp, "\"%s\"", word) >= 0)
{
weechat_completion_list_add (completion, temp, 0, WEECHAT_LIST_POS_END);
free (temp);
}
}
/*