My patch isn't correct.  It misses the case where there's only 1 item
in find_list.

I've attached a new patch which should correctly free the memory.


On Thu, May 1, 2014 at 1:48 AM, J Raynor <jxray...@gmail.com> wrote:
> It looks like there's a memory leak in cmd_find_window_exec.  This
> function calls cmd_find_window_match, which allocates memory to
> find_data.list_ctx using xstrdup or xasprintf.
>
> cmd_find_window_exec then uses this allocated string in a call to
> format_add, but never frees it.  I've attached a patch which should
> fix this.
diff --git a/cmd-find-window.c b/cmd-find-window.c
index bef9afe..c9f2f69 100644
--- a/cmd-find-window.c
+++ b/cmd-find-window.c
@@ -200,6 +200,9 @@ cmd_find_window_exec(struct cmd *self, struct cmd_q *cmdq)
 	window_choose_ready(wl->window->active, 0, cmd_find_window_callback);
 
 out:
+	for (i = 0; i < ARRAY_LENGTH(&find_list); i++)
+		free(ARRAY_ITEM(&find_list, i).list_ctx);
+
 	ARRAY_FREE(&find_list);
 	return (CMD_RETURN_NORMAL);
 }
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to