From e9b990254a68a7228c217f8b26760ac9ffd5431d Mon Sep 17 00:00:00 2001 From: Vern Paxson Date: Fri, 8 Dec 2023 15:08:28 -0500 Subject: [PATCH] memory-handling fixes for information associated with low-level ZAM instructions --- src/script_opt/ZAM/Driver.cc | 3 +-- src/script_opt/ZAM/ZBody.cc | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/script_opt/ZAM/Driver.cc b/src/script_opt/ZAM/Driver.cc index 614beba6c2..5840d56a9f 100644 --- a/src/script_opt/ZAM/Driver.cc +++ b/src/script_opt/ZAM/Driver.cc @@ -210,8 +210,7 @@ void ZAMCompiler::ResolveHookBreaks() { // Rewrite the breaks. for ( auto& b : breaks[0] ) { auto& i = insts1[b.stmt_num]; - delete i; - i = new ZInstI(OP_HOOK_BREAK_X); + *i = ZInstI(OP_HOOK_BREAK_X); } } diff --git a/src/script_opt/ZAM/ZBody.cc b/src/script_opt/ZAM/ZBody.cc index 9b77da28ff..1b40902155 100644 --- a/src/script_opt/ZAM/ZBody.cc +++ b/src/script_opt/ZAM/ZBody.cc @@ -197,8 +197,8 @@ void ZBody::SetInsts(vector& instsI) { if ( iI.stmt ) { auto l = iI.stmt->Original()->GetLocationInfo(); if ( l != &no_location ) - insts_copy[i].loc = std::make_shared(util::copy_string(l->filename), l->first_line, - l->last_line, l->first_column, l->last_column); + insts_copy[i].loc = std::make_shared(l->filename, l->first_line, l->last_line, + l->first_column, l->last_column); } }