Skip to content

Commit 2f13a4e

Browse files
authored
check perf_map_entry for NULL.
nothing we can do but skip writing an entry, but at least _we_ won't be the cause of a crash and something that might generate an appropriate error real soon can be instead.
1 parent 1ff695a commit 2f13a4e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Python/perf_trampoline.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,9 @@ perf_map_write_entry(void *state, const void *code_addr,
208208
}
209209
size_t perf_map_entry_size = snprintf(NULL, 0, "py::%s:%s", entry, filename) + 1;
210210
char* perf_map_entry = (char*) malloc(perf_map_entry_size);
211+
if (perf_map_entry == NULL) {
212+
return;
213+
}
211214
snprintf(perf_map_entry, perf_map_entry_size, "py::%s:%s", entry, filename);
212215
PyUnstable_WritePerfMapEntry(code_addr, code_size, perf_map_entry);
213216
free(perf_map_entry);

0 commit comments

Comments
 (0)