1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-10 03:33:12 +02:00

irc: replace calls to malloc by weechat_asprintf

This commit is contained in:
Sébastien Helleu
2024-12-17 20:41:49 +01:00
parent cdb4823fad
commit 45509e1cd1
12 changed files with 161 additions and 263 deletions
+8 -9
View File
@@ -943,23 +943,22 @@ irc_message_split_add (struct t_irc_message_split_context *context,
if (message)
{
length = ((tags) ? strlen (tags) : 0) + strlen (message) + 1;
buf = malloc (length);
if (buf)
snprintf (key, sizeof (key), "msg%d", context->number);
if (weechat_asprintf (&buf,
"%s%s",
(tags) ? tags : "",
message) >= 0)
{
snprintf (key, sizeof (key), "msg%d", context->number);
snprintf (buf, length, "%s%s",
(tags) ? tags : "",
message);
length = strlen (buf);
weechat_hashtable_set (context->hashtable, key, buf);
if (weechat_irc_plugin->debug >= 2)
{
weechat_printf (NULL,
"irc_message_split_add >> %s='%s' (%d bytes)",
key, buf, length - 1);
key, buf, length);
}
free (buf);
context->total_bytes += length;
context->total_bytes += length + 1;
}
}
if (arguments)