From: Pali Rohár Date: Wed, 7 Jun 2023 17:53:32 +0000 (+0200) Subject: libpci: i386-io-windows.h: Fix memory leak in grant_process_token_dacl_permissions() X-Git-Tag: v3.11.0~71 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=6e50724345522dce3f74f076dc2a0662956ba933;p=pciutils.git libpci: i386-io-windows.h: Fix memory leak in grant_process_token_dacl_permissions() When SetEntriesInAcl() call success then new_dacl allocated by this function has to be released by LocalFree() call. --- diff --git a/lib/i386-io-windows.h b/lib/i386-io-windows.h index 8089d19..73af883 100644 --- a/lib/i386-io-windows.h +++ b/lib/i386-io-windows.h @@ -592,12 +592,14 @@ grant_process_token_dacl_permissions(HANDLE process, DWORD permissions, HANDLE * if (MySetSecurityInfo(*token, SE_KERNEL_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, new_dacl, NULL) != ERROR_SUCCESS) { + LocalFree(new_dacl); LocalFree(*security_descriptor); LocalFree(owner); CloseHandle(*token); return FALSE; } + LocalFree(new_dacl); LocalFree(owner); return TRUE; }