From 7ecf4ae11df97efa2113dad8855eb8d9cb1a9498 Mon Sep 17 00:00:00 2001 From: Dennis Brentjes Date: Sun, 30 Oct 2016 19:59:52 +0100 Subject: Adds a small testcase to trace down the memory leaks I was having. --- scratchpad/scratchpad.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/scratchpad/scratchpad.c b/scratchpad/scratchpad.c index 1cb2e56..49a484f 100644 --- a/scratchpad/scratchpad.c +++ b/scratchpad/scratchpad.c @@ -8,13 +8,35 @@ #include #include +#include void cmix_buffer_scratch(); void crypto_api_scratch(); void gcrypt_scratch(); int main(int argc, char* argv[]) { - gcrypt_scratch(); + if (!gcry_check_version (GCRYPT_VERSION)) { + fprintf(stderr, "libgcrypt version mismatch\n"); + exit(-1); + } + + gcry_control (GCRYCTL_SUSPEND_SECMEM_WARN); + gcry_control (GCRYCTL_INIT_SECMEM, 16384, 0); + gcry_control (GCRYCTL_RESUME_SECMEM_WARN); + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); + + size_t parse_error_offset; + gcry_error_t error; + + char bytes[] = "a"; + gcry_mpi_t x;// = gcry_mpi_snew(0); + error = gcry_mpi_scan(&x, GCRYMPI_FMT_USG, bytes, 1, &parse_error_offset); + + gcry_mpi_release(x); + + if(error) { + return -1; + } return 0; } -- cgit v1.2.3-70-g09d2