From 55f680bf5f8c10555f50cabd45df78e24cffb3fa Mon Sep 17 00:00:00 2001 From: Kostiantyn Kostiuk Date: Mon, 9 Dec 2024 06:38:22 -0800 Subject: [PATCH] RHEL-70458: Balloon: Finish WMI requiest properly Signed-off-by: Kostiantyn Kostiuk --- Balloon/app/memstat.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Balloon/app/memstat.cpp b/Balloon/app/memstat.cpp index bfa498e14..cc74fd3a5 100644 --- a/Balloon/app/memstat.cpp +++ b/Balloon/app/memstat.cpp @@ -196,5 +196,23 @@ BOOL CMemStat::Update() m_Stats[idx++].val = 0; } + while (true) + { + if (enumerator == NULL) + break; + + if (FAILED(enumerator->Next(WBEM_INFINITE, 1L, &memory, &retcnt))) + { + PrintMessage("Cannot again enumerate results"); + break; + } + + if (retcnt == 0) + { + PrintMessage("No more results found"); + break; + } + } + return TRUE; }