]> mj.ucw.cz Git - pciutils.git/commitdiff
libpci: i386-io-windows.h: Fix memory leak in grant_process_token_dacl_permissions()
authorPali Rohár <pali@kernel.org>
Wed, 7 Jun 2023 17:53:32 +0000 (19:53 +0200)
committerMartin Mares <mj@ucw.cz>
Fri, 29 Dec 2023 13:30:02 +0000 (14:30 +0100)
When SetEntriesInAcl() call success then new_dacl allocated by this
function has to be released by LocalFree() call.

lib/i386-io-windows.h

index 8089d19b3a28922bfe93d674b4a0a801dc3966cb..73af8835101ccd6a814b5e2005719933d71494b5 100644 (file)
@@ -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;
 }