From 88b66e9e28733676b15a996d8fb5cbf66e01bc88 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 18 Sep 2020 11:23:29 +0000 Subject: [PATCH] Free buffer earlier to avoid confusing some compilers, GitHub issue 2382. --- window-copy.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/window-copy.c b/window-copy.c index 640a69ec..e46c910c 100644 --- a/window-copy.c +++ b/window-copy.c @@ -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(®); - } 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(®); - } return (1); }