diff options
Diffstat (limited to 'winpr/libwinpr/path/path.c')
-rw-r--r-- | winpr/libwinpr/path/path.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/winpr/libwinpr/path/path.c b/winpr/libwinpr/path/path.c index 82e6be1..3f20465 100644 --- a/winpr/libwinpr/path/path.c +++ b/winpr/libwinpr/path/path.c @@ -1002,7 +1002,7 @@ PCSTR PathGetSharedLibraryExtensionA(unsigned long dwFlags) PCWSTR PathGetSharedLibraryExtensionW(unsigned long dwFlags) { - WCHAR buffer[6][16] = { 0 }; + static WCHAR buffer[6][16] = { 0 }; const WCHAR* SharedLibraryExtensionDotDllW = InitializeConstWCharFromUtf8( SharedLibraryExtensionDotDllA, buffer[0], ARRAYSIZE(buffer[0])); const WCHAR* SharedLibraryExtensionDotSoW = @@ -1131,11 +1131,12 @@ BOOL winpr_RemoveDirectory_RecursiveW(LPCWSTR lpPathName) WCHAR starbuffer[8] = { 0 }; const WCHAR* star = InitializeConstWCharFromUtf8("*", starbuffer, ARRAYSIZE(starbuffer)); const HRESULT hr = NativePathCchAppendW(path_slash, path_slash_len, star); + HANDLE dir = INVALID_HANDLE_VALUE; if (FAILED(hr)) goto fail; WIN32_FIND_DATAW findFileData = { 0 }; - HANDLE dir = FindFirstFileW(path_slash, &findFileData); + dir = FindFirstFileW(path_slash, &findFileData); if (dir == INVALID_HANDLE_VALUE) goto fail; @@ -1167,8 +1168,6 @@ BOOL winpr_RemoveDirectory_RecursiveW(LPCWSTR lpPathName) break; } while (ret && FindNextFileW(dir, &findFileData) != 0); - FindClose(dir); - if (ret) { if (!RemoveDirectoryW(lpPathName)) @@ -1176,6 +1175,7 @@ BOOL winpr_RemoveDirectory_RecursiveW(LPCWSTR lpPathName) } fail: + FindClose(dir); free(path_slash); return ret; } |