Skip to content

Commit ec1d48d

Browse files
committed
fix lock leak introduced by initial change
1 parent 636652d commit ec1d48d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Python/sysmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2515,12 +2515,12 @@ PyAPI_FUNC(int) PyUnstable_CopyPerfMapFile(const char* parent_filename) {
25152515
return ret;
25162516
}
25172517
}
2518-
char buf[4096];
2519-
PyThread_acquire_lock(perf_map_state.map_lock, 1);
25202518
FILE* from = fopen(parent_filename, "r");
25212519
if (!from) {
25222520
return -1;
25232521
}
2522+
char buf[4096];
2523+
PyThread_acquire_lock(perf_map_state.map_lock, 1);
25242524
int fflush_result = 0, result = 0;
25252525
while (1) {
25262526
size_t bytes_read = fread(buf, 1, sizeof(buf), from);

0 commit comments

Comments
 (0)