From 98d449e93168e8b66d8938adfa05149f11059bc1 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 9 May 2022 07:09:47 -0700 Subject: Use resizebuf instead of realloc. --- pw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pw.c b/pw.c index 6c36a90..28d1e98 100644 --- a/pw.c +++ b/pw.c @@ -1780,7 +1780,7 @@ int main(int argc, char **argv) &cmdhist : &pathist); if (nhist == 0 || strcmp(pw.cmdbuf, (*hist)[0]) != 0) { - if ((*hist = realloc(*hist, sizeof **hist*(nhist + 1))) == 0) + if ((*hist = resizebuf(*hist, nhist, nhist + 1)) == 0) panic("out of memory"); memmove(*hist + 1, *hist, sizeof **hist * nhist); *pnhist = nhist + 1; -- cgit v1.2.3