aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--main.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/main.c b/main.c
index c5a7cff9..c23a1a7f 100644
--- a/main.c
+++ b/main.c
@@ -1,4 +1,4 @@
-/* $Id: main.c,v 1.358 2021/09/04 22:38:46 schwarze Exp $ */
+/* $Id: main.c,v 1.359 2021/10/04 20:24:06 schwarze Exp $ */
/*
* Copyright (c) 2010-2012, 2014-2021 Ingo Schwarze <schwarze@openbsd.org>
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
@@ -516,6 +516,9 @@ main(int argc, char *argv[])
memcpy(res + ressz, resn,
sizeof(*resn) * resnsz);
ressz += resnsz;
+ free(resn);
+ resn = NULL;
+ resnsz = 0;
continue;
}
@@ -554,6 +557,10 @@ main(int argc, char *argv[])
res = mandoc_reallocarray(res, ressz + 1,
sizeof(*res));
memcpy(res + ressz++, resn + ib, sizeof(*resn));
+ memset(resn + ib, 0, sizeof(*resn));
+ mansearch_free(resn, resnsz);
+ resn = NULL;
+ resnsz = 0;
}
/* apropos(1), whatis(1): Process the full search expression. */