From c391bdba5dcad1c6039f01a7bba72bf3f2781e80 Mon Sep 17 00:00:00 2001 From: "peter.cullen" Date: Thu, 19 Oct 2023 12:52:49 -0400 Subject: [PATCH] Fix mmdb pointer destruction The mmdb references needs to use reset() instead of release() so that the destructor gets called and the stale DB is actually cleaned up. Otherwise, the pointer is leaked and the stale DB remains in memory. --- src/zeek.bif | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/zeek.bif b/src/zeek.bif index 4c115ca4f3..c027842c2b 100644 --- a/src/zeek.bif +++ b/src/zeek.bif @@ -4011,7 +4011,7 @@ static void report_mmdb_msg(const char* format, ...) va_list al; va_start(al, format); - std::string msg = zeek::util::fmt(format, al); + std::string msg = zeek::util::vfmt(format, al); va_end(al); zeek::reporter->Info("%s", msg.data()); @@ -4159,7 +4159,7 @@ static void mmdb_check_loc() { report_mmdb_msg("Closing stale MaxMind DB [%s]", mmdb_loc->Filename()); did_mmdb_loc_db_error = false; - mmdb_loc.release(); + mmdb_loc.reset(); } } @@ -4169,7 +4169,7 @@ static void mmdb_check_asn() { report_mmdb_msg("Closing stale MaxMind DB [%s]", mmdb_asn->Filename()); did_mmdb_asn_db_error = false; - mmdb_asn.release(); + mmdb_asn.reset(); } }