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")) !PathCombineW(InfPath, RandomTempSubDirectory, L"wintun.inf"))
{ {
Result = ERROR_BUFFER_OVERFLOW; Result = ERROR_BUFFER_OVERFLOW;
goto cleanupFree; goto cleanupDirectory;
} }
BOOL UseWHQL = HaveWHQL(); BOOL UseWHQL = HaveWHQL();
@ -354,6 +354,7 @@ cleanupDelete:
DeleteFileW(CatPath); DeleteFileW(CatPath);
DeleteFileW(SysPath); DeleteFileW(SysPath);
DeleteFileW(InfPath); DeleteFileW(InfPath);
cleanupDirectory:
RemoveDirectoryW(RandomTempSubDirectory); RemoveDirectoryW(RandomTempSubDirectory);
cleanupFree: cleanupFree:
LocalFree(SecurityAttributes.lpSecurityDescriptor); LocalFree(SecurityAttributes.lpSecurityDescriptor);