summary refs log tree commit diff
path: root/kbfunc.c
diff options
context:
space:
mode:
authoroga <oga>2008-04-08 17:38:27 +0000
committeroga <oga>2008-04-08 17:38:27 +0000
commiteb77aabea1029d97489611c71c11ab32e7329cee (patch)
tree802ae987f5ef36ba74ccc618c87ad1e6eeafe1dc /kbfunc.c
parent9702d4cfd7f41866b97849e4ed62ab7b91071054 (diff)
downloadcwm-eb77aabea1029d97489611c71c11ab32e7329cee.tar.gz
cwm-eb77aabea1029d97489611c71c11ab32e7329cee.tar.xz
cwm-eb77aabea1029d97489611c71c11ab32e7329cee.zip
No cookie for okan.
fix use-after-free that broke exec's path getting stuff.

``paths'' isn't used anymore, but pointers to within that array are still
used in the next loop. delay freeing it until after then.
Diffstat (limited to 'kbfunc.c')
-rw-r--r--kbfunc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kbfunc.c b/kbfunc.c
index 36d543e..31404c8 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -307,7 +307,6 @@ kbfunc_exec(struct client_ctx *scratch, void *arg)
 			ap++;
 	}
 	*ap = NULL;
-	xfree(path);
 	for (i = 0; i < NPATHS && paths[i] != NULL; i++) {
 		if ((dirp = opendir(paths[i])) == NULL)
 			continue;
@@ -351,6 +350,7 @@ kbfunc_exec(struct client_ctx *scratch, void *arg)
 		}
 		(void) closedir(dirp);
 	}
+	xfree(path);
 
 	if ((mi = search_start(&menuq,
 		    search_match_exec, NULL, label, 1)) != NULL) {