Skip to content

Commit 6516356

Browse files
committed
Ensure we munmap before closing the fd
1 parent 9096375 commit 6516356

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Python/remote_debugging.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,12 +360,12 @@ search_elf_file_for_section(
360360
}
361361

362362
exit:
363-
if (fd >= 0 && close(fd) != 0) {
364-
PyErr_SetFromErrno(PyExc_OSError);
365-
}
366363
if (file_memory != NULL) {
367364
munmap(file_memory, file_stats.st_size);
368365
}
366+
if (fd >= 0 && close(fd) != 0) {
367+
PyErr_SetFromErrno(PyExc_OSError);
368+
}
369369
return result;
370370
}
371371

0 commit comments

Comments
 (0)