os2: fix leak and always close directory

This commit is contained in:
Laytan Laats committed 2024-08-14 01:44:37 +02:00
1 parent f00f68ef6f
commit 939ba4cf08
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -61,6 +61,7 @@ _remove_all :: proc(path: string) -> Error {
if dir == nil {
return _get_platform_error()
}
defer posix.closedir(dir)
for {
posix.set_errno(.NONE)
@@ -91,7 +92,6 @@ _remove_all :: proc(path: string) -> Error {
if posix.rmdir(cpath) != .OK {
return _get_platform_error()
}
posix.closedir(dir)
return nil
}