| ... | ... | @@ -736,7 +736,8 @@ fn fmtPathFile( |
| 736 | 736 | sub_path: []const u8, |
| 737 | 737 | ) FmtError!void { |
| 738 | 738 | const source_file = try dir.openFile(sub_path, .{}); |
| 739 | | defer source_file.close(); |
| 739 | var file_closed = false; |
| 740 | errdefer if (!file_closed) source_file.close(); |
| 740 | 741 | |
| 741 | 742 | const stat = try source_file.stat(); |
| 742 | 743 | |
| ... | ... | @@ -748,6 +749,8 @@ fn fmtPathFile( |
| 748 | 749 | error.ConnectionTimedOut => unreachable, |
| 749 | 750 | else => |e| return e, |
| 750 | 751 | }; |
| 752 | source_file.close(); |
| 753 | file_closed = true; |
| 751 | 754 | defer fmt.gpa.free(source_code); |
| 752 | 755 | |
| 753 | 756 | // Add to set after no longer possible to get error.IsDir. |