summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2020-09-18 11:23:29 +0000
committernicm <nicm@openbsd.org>2020-09-18 11:23:29 +0000
commit71e3f24018fc1c923f9a076a475eb0d56724068e (patch)
tree6948e1295b21632f883c85271ccf4011980d69c3
parentSome other warnings, GitHub issue 2382. (diff)
downloadwireguard-openbsd-71e3f24018fc1c923f9a076a475eb0d56724068e.tar.xz
wireguard-openbsd-71e3f24018fc1c923f9a076a475eb0d56724068e.zip
Free buffer earlier to avoid confusing some compilers, GitHub issue
2382.
-rw-r--r--usr.bin/tmux/window-copy.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c
index 311b3f72067..38b4ed26d6e 100644
--- a/usr.bin/tmux/window-copy.c
+++ b/usr.bin/tmux/window-copy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-copy.c,v 1.303 2020/09/16 18:37:55 nicm Exp $ */
+/* $OpenBSD: window-copy.c,v 1.304 2020/09/18 11:23:29 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -2853,6 +2853,7 @@ window_copy_search_jump(struct window_mode_entry *wme, struct grid *gd,
free(sbuf);
return (0);
}
+ free(sbuf);
}
if (direction) {
@@ -2889,10 +2890,8 @@ window_copy_search_jump(struct window_mode_entry *wme, struct grid *gd,
fx = gd->sx - 1;
}
}
- if (regex) {
- free(sbuf);
+ if (regex)
regfree(&reg);
- }
if (found) {
window_copy_scroll_to(wme, px, i, 1);
@@ -3042,6 +3041,7 @@ window_copy_search_marks(struct window_mode_entry *wme, struct screen *ssp,
free(sbuf);
return (0);
}
+ free(sbuf);
}
tstart = get_timer();
@@ -3139,10 +3139,8 @@ again:
out:
if (ssp == &ss)
screen_free(&ss);
- if (regex) {
- free(sbuf);
+ if (regex)
regfree(&reg);
- }
return (1);
}