Fix a potential memory leak in Debug function

This commit is contained in:
Tim Wojtulewicz 2025-04-04 15:06:14 -07:00
parent 718dc19345
commit 2390625732

View file

@ -160,7 +160,7 @@ int TraceState::LogTrace(const char* fmt, ...) {
if ( ! loc.filename ) { if ( ! loc.filename ) {
static constexpr const char str[] = "<no filename>"; static constexpr const char str[] = "<no filename>";
loc.filename = util::copy_string(str, std::size(str) - 1); loc.filename = str;
loc.last_line = 0; loc.last_line = 0;
} }
@ -679,7 +679,7 @@ string get_context_description(const Stmt* stmt, const Frame* frame) {
loc = *stmt->GetLocationInfo(); loc = *stmt->GetLocationInfo();
else { else {
static constexpr const char str[] = "<no filename>"; static constexpr const char str[] = "<no filename>";
loc.filename = util::copy_string(str, std::size(str) - 1); loc.filename = str;
loc.last_line = 0; loc.last_line = 0;
} }