=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/window-copy.c,v retrieving revision 1.230 retrieving revision 1.231 diff -u -r1.230 -r1.231 --- src/usr.bin/tmux/window-copy.c 2019/08/01 14:31:39 1.230 +++ src/usr.bin/tmux/window-copy.c 2019/08/14 09:58:31 1.231 @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.230 2019/08/01 14:31:39 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.231 2019/08/14 09:58:31 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -1638,9 +1638,11 @@ const char *argument = cs->args->argv[1]; if (*argument != '\0') { - data->searchtype = WINDOW_COPY_SEARCHUP; free(data->searchstr); data->searchstr = xstrdup(argument); + } + if (data->searchstr != NULL) { + data->searchtype = WINDOW_COPY_SEARCHUP; for (; np != 0; np--) window_copy_search_up(wme); } @@ -1656,9 +1658,11 @@ const char *argument = cs->args->argv[1]; if (*argument != '\0') { - data->searchtype = WINDOW_COPY_SEARCHDOWN; free(data->searchstr); data->searchstr = xstrdup(argument); + } + if (data->searchstr != NULL) { + data->searchtype = WINDOW_COPY_SEARCHDOWN; for (; np != 0; np--) window_copy_search_down(wme); } @@ -2139,10 +2143,7 @@ return (0); } -/* - * Search in for text searchstr. If direction is 0 then search up, otherwise - * down. - */ +/* Search in text. If direction is 0 then search up, otherwise down. */ static int window_copy_search(struct window_mode_entry *wme, int direction) {