1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 13:26:38 +02:00

ruby: replace call to malloc by weechat_asprintf

This commit is contained in:
Sébastien Helleu
2024-12-17 21:01:16 +01:00
parent b45d2105a5
commit 68dce2b47a
+3 -6
View File
@@ -352,7 +352,6 @@ weechat_ruby_output_flush ()
{
const char *ptr_command;
char *temp_buffer, *command;
int length;
if (!(*ruby_buffer_output)[0])
return;
@@ -381,12 +380,10 @@ weechat_ruby_output_flush ()
}
else
{
length = 1 + strlen (temp_buffer) + 1;
command = malloc (length);
if (command)
if (weechat_asprintf (&command,
"%c%s",
temp_buffer[0], temp_buffer) >= 0)
{
snprintf (command, length, "%c%s",
temp_buffer[0], temp_buffer);
weechat_command (ruby_eval_buffer,
(command[0]) ? command : " ");
free (command);