about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorDmitry Podgorny <pasis.ua@gmail.com>2017-07-01 17:01:49 +0300
committerDmitry Podgorny <pasis.ua@gmail.com>2017-07-01 17:01:49 +0300
commitda51d998316518da65a32be79fa653254c34bf1a (patch)
treea6a41c5d2cd8c6bd3f60acba7f21a1a41e0f58b0 /src/command
parent4a6bf6872745e5afa9cdfdbe00f7346ce1724d48 (diff)
downloadprofani-tty-da51d998316518da65a32be79fa653254c34bf1a.tar.gz
Fix memory leak in cmd_init()
_cmd_index() returns string allocated by glib.
Diffstat (limited to 'src/command')
-rw-r--r--src/command/cmd_defs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c
index ae77bf53..37ae0442 100644
--- a/src/command/cmd_defs.c
+++ b/src/command/cmd_defs.c
@@ -2384,7 +2384,7 @@ cmd_init(void)
 
     cmd_ac_init();
 
-    search_index = g_hash_table_new_full(g_str_hash, g_str_equal, free, free);
+    search_index = g_hash_table_new_full(g_str_hash, g_str_equal, free, g_free);
 
     // load command defs into hash table
     commands = g_hash_table_new(g_str_hash, g_str_equal);
@@ -2396,7 +2396,7 @@ cmd_init(void)
         g_hash_table_insert(commands, pcmd->cmd, pcmd);
 
         // add to search index
-        g_hash_table_insert(search_index, strdup(pcmd->cmd), strdup(_cmd_index(pcmd)));
+        g_hash_table_insert(search_index, strdup(pcmd->cmd), _cmd_index(pcmd));
 
         // add to commands and help autocompleters
         cmd_ac_add_cmd(pcmd);