core: fix memory in execution of commands

This memory leak was introduced by commit aa81067ad070f05a4aaf98383781eba0fbafefd6
This commit is contained in:
Sebastien Helleu 2014-03-02 17:59:40 +01:00
parent 32a4f4e1d5
commit be9046741f

View File

@ -90,6 +90,11 @@ input_exec_command (struct t_gui_buffer *buffer,
pos = strchr (command, ' ');
command_name = (pos) ?
string_strndup (command, pos - command) : strdup (command);
if (!command_name)
{
free (command);
return;
}
/* execute command */
switch (hook_command_exec (buffer, any_plugin, plugin, command))
@ -139,6 +144,7 @@ input_exec_command (struct t_gui_buffer *buffer,
break;
}
free (command);
free (command_name);
}
/*