X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/03b3169e54fbe4d4cae99307810b1f52f85c8f5a..3937740937e41c25c87a241c243e7ec7e6abf0f8:/projects/stargazer/traffcounter.cpp diff --git a/projects/stargazer/traffcounter.cpp b/projects/stargazer/traffcounter.cpp index e834b81f..1d088f48 100644 --- a/projects/stargazer/traffcounter.cpp +++ b/projects/stargazer/traffcounter.cpp @@ -30,6 +30,7 @@ #include #include +#include // Functions fopen and similar #include "traffcounter.h" #include "common.h" @@ -409,7 +410,7 @@ printfd(__FILE__, "AddUser: %s\n", user->GetLogin().c_str()); uint32_t uip = user->GetCurrIP(); pair pi; -STG_LOCKER(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex, __FILE__, __LINE__); // Find all packets with IP belongs to this user pi = ip2packets.equal_range(uip); @@ -446,7 +447,7 @@ void TRAFFCOUNTER::DelUser(uint32_t uip) printfd(__FILE__, "DelUser: %s \n", inet_ntostring(uip).c_str()); pair pi; -STG_LOCKER(&mutex, __FILE__, __LINE__); +STG_LOCKER lock(&mutex, __FILE__, __LINE__); pi = ip2packets.equal_range(uip); while (pi.first != pi.second) @@ -698,6 +699,7 @@ while (fgets(str, 1023, f)) if (r != 3) { WriteServLog("Error in file %s. There must be 3 parameters. Line %d.", rulesFileName.c_str(), lineNumber); + fclose(f); return true; } @@ -720,6 +722,7 @@ while (fgets(str, 1023, f)) { WriteServLog("Error in file %s. Line %d.", rulesFileName.c_str(), lineNumber); + fclose(f); return true; } @@ -727,6 +730,7 @@ while (fgets(str, 1023, f)) { WriteServLog("Error in file %s. Error in adress. Line %d.", rulesFileName.c_str(), lineNumber); + fclose(f); return true; } if (!test)