mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
lua: replace call to malloc by weechat_asprintf
This commit is contained in:
@@ -190,7 +190,6 @@ weechat_lua_output_flush ()
|
||||
{
|
||||
const char *ptr_command;
|
||||
char *temp_buffer, *command;
|
||||
int length;
|
||||
|
||||
if (!(*lua_buffer_output)[0])
|
||||
return;
|
||||
@@ -219,12 +218,11 @@ weechat_lua_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 (lua_eval_buffer,
|
||||
(command[0]) ? command : " ");
|
||||
free (command);
|
||||
|
||||
Reference in New Issue
Block a user