Skip to content

Commit b5aa057

Browse files
authored
codegen: fix use-after-free of module name (#49011)
1 parent 5eab451 commit b5aa057

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/codegen.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8459,11 +8459,11 @@ jl_llvm_functions_t jl_emit_code(
84598459
JL_CATCH {
84608460
// Something failed! This is very, very bad.
84618461
// Try to pretend that it isn't and attempt to recover.
8462-
const char *mname = m.getModuleUnlocked()->getModuleIdentifier().data();
8462+
std::string mname = m.getModuleUnlocked()->getModuleIdentifier();
84638463
m = orc::ThreadSafeModule();
84648464
decls.functionObject = "";
84658465
decls.specFunctionObject = "";
8466-
jl_printf((JL_STREAM*)STDERR_FILENO, "Internal error: encountered unexpected error during compilation of %s:\n", mname);
8466+
jl_printf((JL_STREAM*)STDERR_FILENO, "Internal error: encountered unexpected error during compilation of %s:\n", mname.c_str());
84678467
jl_static_show((JL_STREAM*)STDERR_FILENO, jl_current_exception());
84688468
jl_printf((JL_STREAM*)STDERR_FILENO, "\n");
84698469
jlbacktrace(); // written to STDERR_FILENO

0 commit comments

Comments
 (0)