From c1f4d263ec1004512cdd6b38b351eb2fe2321c22 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 5 Mar 2016 22:27:04 +0100 Subject: Add memory pool, also let the user know that libzahl is not designed for cryptography MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/zunsetup.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/zunsetup.c') diff --git a/src/zunsetup.c b/src/zunsetup.c index 184f96f..9926354 100644 --- a/src/zunsetup.c +++ b/src/zunsetup.c @@ -9,14 +9,20 @@ zunsetup(void) if (libzahl_set_up) { libzahl_set_up = 0; #define X(x)\ - zfree(x); + free(x->chars); LIST_TEMPS; #undef X #define X(x, f, v)\ - zfree(x); + free(x->chars); LIST_CONSTS; #undef X for (i = BITS_PER_CHAR; i--;) - zfree(libzahl_tmp_divmod_ds[i]); + free(libzahl_tmp_divmod_ds[i]->chars); + + for (i = sizeof(libzahl_pool) / sizeof(*libzahl_pool); i--;) { + while (libzahl_pool_n[i]--) + free(libzahl_pool[i][libzahl_pool_n[i]]); + free(libzahl_pool[i]); + } } } -- cgit v1.2.3-70-g09d2