From cf989b0b9c03af8622adbc1750456f130d9094f7 Mon Sep 17 00:00:00 2001 From: Carl Edquist Date: Mon, 20 Jun 2022 15:00:04 -0500 Subject: [PATCH 1/2] fix apparent fd-leak of sqlite handle --- src/scitokens_cache.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/scitokens_cache.cpp b/src/scitokens_cache.cpp index 0538dc5..50d7801 100644 --- a/src/scitokens_cache.cpp +++ b/src/scitokens_cache.cpp @@ -250,5 +250,6 @@ scitokens::Validator::store_public_keys(const std::string &issuer, const picojso sqlite3_exec(db, "COMMIT", 0, 0 , 0); + sqlite3_close(db); return true; } From 64d77c381677d4eb1b17954a35602be88063a1f4 Mon Sep 17 00:00:00 2001 From: Carl Edquist Date: Mon, 20 Jun 2022 18:38:36 -0500 Subject: [PATCH 2/2] destroy prepared stmt object on success, too if I'm reading this right, the local stmt object will leak here too if not finalized --- src/scitokens_cache.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/scitokens_cache.cpp b/src/scitokens_cache.cpp index 50d7801..dd4e5c7 100644 --- a/src/scitokens_cache.cpp +++ b/src/scitokens_cache.cpp @@ -250,6 +250,7 @@ scitokens::Validator::store_public_keys(const std::string &issuer, const picojso sqlite3_exec(db, "COMMIT", 0, 0 , 0); + sqlite3_finalize(stmt); sqlite3_close(db); return true; }