diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-05-09 07:09:47 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-05-09 07:09:47 -0700 |
commit | 98d449e93168e8b66d8938adfa05149f11059bc1 (patch) | |
tree | e7b0bb2d43544debaf66d44d57841d58d845ac7c | |
parent | 18f2cbf0d59c8828e9220f2a01c69bed8f450529 (diff) | |
download | pw-98d449e93168e8b66d8938adfa05149f11059bc1.tar.gz pw-98d449e93168e8b66d8938adfa05149f11059bc1.tar.bz2 pw-98d449e93168e8b66d8938adfa05149f11059bc1.zip |
Use resizebuf instead of realloc.
-rw-r--r-- | pw.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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; |