From be9046741f87e2eb6fd229945d05f05b6713bd25 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sun, 2 Mar 2014 17:59:40 +0100 Subject: [PATCH] core: fix memory in execution of commands This memory leak was introduced by commit aa81067ad070f05a4aaf98383781eba0fbafefd6 --- src/core/wee-input.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/wee-input.c b/src/core/wee-input.c index 56d1cdfe5..e8ca08605 100644 --- a/src/core/wee-input.c +++ b/src/core/wee-input.c @@ -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); } /*