api: remove temporary folder in case of intermediate failure

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2020-10-15 14:57:09 +02:00 committed by Jason A. Donenfeld
parent 369801cdfa
commit 70461121f7

View File

@ -320,7 +320,7 @@ InstallDriver(_In_ BOOL UpdateExisting)
!PathCombineW(InfPath, RandomTempSubDirectory, L"wintun.inf"))
{
Result = ERROR_BUFFER_OVERFLOW;
goto cleanupFree;
goto cleanupDirectory;
}
BOOL UseWHQL = HaveWHQL();
@ -354,6 +354,7 @@ cleanupDelete:
DeleteFileW(CatPath);
DeleteFileW(SysPath);
DeleteFileW(InfPath);
cleanupDirectory:
RemoveDirectoryW(RandomTempSubDirectory);
cleanupFree:
LocalFree(SecurityAttributes.lpSecurityDescriptor);