From 9289b4d476f45493d04fab59a9498b028299522c Mon Sep 17 00:00:00 2001 From: Kris Zyp Date: Tue, 20 Aug 2024 12:38:04 -0600 Subject: [PATCH] Address valgrind warnings to properly initializer lastReaderCheck and delete the open envs vector, #300 --- src/env.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/env.cpp b/src/env.cpp index 5aa36701c..fb6d125d4 100644 --- a/src/env.cpp +++ b/src/env.cpp @@ -38,7 +38,7 @@ static napi_ref testRef; static napi_env testRefEnv; void EnvWrap::cleanupEnvWraps(void* data) { if (openEnvWraps) - free(openEnvWraps); + delete openEnvWraps; else fprintf(stderr, "How do we end up cleanup env wraps that don't exist?\n"); openEnvWraps = nullptr; @@ -59,6 +59,7 @@ EnvWrap::EnvWrap(const CallbackInfo& info) : ObjectWrap(info) { this->writeWorker = nullptr; this->readTxnRenewed = false; this->hasWrites = false; + this->lastReaderCheck = 0; this->writingLock = new pthread_mutex_t; this->writingCond = new pthread_cond_t; info.This().As().Set("address", Number::New(info.Env(), (size_t) this));