From: Gunnar Beutner Date: Mon, 2 Mar 2015 12:22:37 +0000 (+0100) Subject: Remove redundant checks in check_procs X-Git-Tag: v2.3.0~61 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3087be2567763fd9d23097d07327109eb23fdf3f;p=icinga2 Remove redundant checks in check_procs --- diff --git a/plugins/check_procs.cpp b/plugins/check_procs.cpp index c5904eca2..8747cb66c 100644 --- a/plugins/check_procs.cpp +++ b/plugins/check_procs.cpp @@ -297,14 +297,8 @@ int countProcs(const wstring user) pSIDTokenUser = reinterpret_cast(new BYTE[dwReturnLength]); memset(pSIDTokenUser, 0, dwReturnLength); - if (!pSIDTokenUser) { - if (debug) - wcout << L"Could not recieve token, skiping" << endl; - continue; - } - if (debug) - wcout << L"Recieved token, saving information" << endl; + wcout << L"Received token, saving information" << endl; //write Info in pSIDTokenUser if (!GetTokenInformation(hToken, TokenUser, pSIDTokenUser, dwReturnLength, NULL)) @@ -327,9 +321,6 @@ int countProcs(const wstring user) AcctName = reinterpret_cast(new WCHAR[dwAcctName]); DomainName = reinterpret_cast(new WCHAR[dwDomainName]); - if (!AcctName || !DomainName) - continue; - if (!LookupAccountSid(NULL, pSIDTokenUser->User.Sid, AcctName, (LPDWORD)&dwAcctName, DomainName, (LPDWORD)&dwDomainName, &sidNameUse)) continue; @@ -346,7 +337,6 @@ int countProcs(const wstring user) delete[] reinterpret_cast(DomainName); } while (Process32Next(hProcessSnap, &pe32)); - die: if (hProcessSnap) @@ -358,4 +348,4 @@ die: if (pSIDTokenUser) delete[] reinterpret_cast(pSIDTokenUser); return numProcs; -} \ No newline at end of file +}