From c8eebc0d98e8bd0a8daaef227fe6bdbadd8999a0 Mon Sep 17 00:00:00 2001 From: Dani Kamanovsky Date: Sun, 3 Nov 2024 15:29:25 +0200 Subject: [PATCH] memory leak in GetProviderGUIDByDescription memory allocation is not freed if a match is found in the loop, leading to a memory leak --- utils.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/utils.c b/utils.c index 19c7ab5..c0ed715 100644 --- a/utils.c +++ b/utils.c @@ -218,11 +218,13 @@ BOOL GetProviderGUIDByDescription(PCWSTR providerDescription, GUID* outProviderG return FALSE; } + BOOL found = FALSE; for (UINT32 i = 0; i < numProviders; i++) { if (providers[i]->displayData.description != NULL) { if (wcscmp(providers[i]->displayData.description, providerDescription) == 0) { *outProviderGUID = providers[i]->providerKey; - return TRUE; + found = TRUE; + break; } } } @@ -233,5 +235,5 @@ BOOL GetProviderGUIDByDescription(PCWSTR providerDescription, GUID* outProviderG FwpmProviderDestroyEnumHandle0(hEngine, enumHandle); FwpmEngineClose0(hEngine); - return FALSE; -} \ No newline at end of file + return found; +}