Skip to content

Commit 2c20069

Browse files
committed
Fix a possible leak of a file descriptor
The same issue as ruby/prism#3246
1 parent 43b059b commit 2c20069

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

prism_compile.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10900,6 +10900,7 @@ pm_read_file(pm_string_t *string, const char *filepath)
1090010900

1090110901
source = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
1090210902
if (source == MAP_FAILED) {
10903+
close(fd);
1090310904
return PM_STRING_INIT_ERROR_GENERIC;
1090410905
}
1090510906

0 commit comments

Comments
 (0)