From 7b0e2763ffdb77848b869f636dac5fbc364d66e1 Mon Sep 17 00:00:00 2001 From: Tyler Perkins Date: Fri, 29 Apr 2022 12:45:44 -0400 Subject: [PATCH] Close file in memory.cpp --- src/components/memory.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/memory.cpp b/src/components/memory.cpp index 4bae939..ae69f4d 100644 --- a/src/components/memory.cpp +++ b/src/components/memory.cpp @@ -25,6 +25,8 @@ bool memory::getProcMem(crow::json::wvalue& ret){ ret[line.substr(0,colon)] = std::stof(line.substr(last_space, final_space - last_space)); } + + f.close(); } else { ret["message"] = "Failed to open proc filesystem"; return false; @@ -41,6 +43,7 @@ bool memory::getRawProcMem(std::string& ret){ ret += line; ret += "\n"; } + f.close(); } else { ret = "Failed to open proc filesystem"; return false;