From 5ba2dbddd46863005885f38c98a744a2ac83d18d Mon Sep 17 00:00:00 2001 From: whatdoineed2do/Ray Date: Mon, 25 Sep 2023 12:05:23 +0100 Subject: [PATCH] EC/BN memleak --- src/cli.cpp | 10 ++++++++++ src/cli.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/cli.cpp b/src/cli.cpp index 1d38966..df1ccf0 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -22,6 +22,15 @@ #include "cli.h" +CLI::~CLI() +{ + EC_GROUP_free(eCurve); + EC_POINT_free(genPoint); + EC_POINT_free(pubPoint); + BN_free(privateKey); + BN_free(genOrder); +} + bool CLI::loadJSON(const fs::path& filename, json *output) { if (!filename.empty() && !fs::exists(filename)) { fmt::print("ERROR: File {} does not exist\n", filename.string()); @@ -417,6 +426,7 @@ int CLI::BINK1998Generate() { sscanf(cRaw, "%d", &oRaw); nRaw += (oRaw % 999999); // ensure our serial is less than 999999 + BN_free(bnrand); } if (this->options.verbose) { diff --git a/src/cli.h b/src/cli.h index 0c80bf7..c73104a 100644 --- a/src/cli.h +++ b/src/cli.h @@ -85,6 +85,7 @@ class CLI { public: CLI(Options options, json keys); + ~CLI(); static bool loadJSON(const fs::path& filename, json *output); static void showHelp(char *argv[]);