diff --git a/window-tree.c b/window-tree.c index 2f17a361..89b5e648 100644 --- a/window-tree.c +++ b/window-tree.c @@ -860,8 +860,10 @@ window_tree_search(__unused void *modedata, void *itemdata, const char *ss) if (s == NULL || wl == NULL || wp == NULL) break; cmd = get_proc_name(wp->fd, wp->tty); - if (cmd == NULL || *cmd == '\0') + if (cmd == NULL || *cmd == '\0') { + free(cmd); return (0); + } retval = (strstr(cmd, ss) != NULL); free(cmd); return (retval);