From: Joel Hestness Date: Mon, 8 Apr 2013 01:31:15 +0000 (-0500) Subject: Ruby System, Cache Recorder: Use delete [] for trace vars X-Git-Tag: stable_2013_06_16~16 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3b02210713a3b8f46750638003784115a738ec78;p=gem5.git Ruby System, Cache Recorder: Use delete [] for trace vars The cache trace variables are array allocated uint8_t* in the RubySystem and the Ruby CacheRecorder, but the code used delete to free the memory, resulting in Valgrind memory errors. Change these deletes to delete [] to get rid of the errors. --- diff --git a/src/mem/ruby/recorder/CacheRecorder.cc b/src/mem/ruby/recorder/CacheRecorder.cc index c5593d945..1e029b400 100644 --- a/src/mem/ruby/recorder/CacheRecorder.cc +++ b/src/mem/ruby/recorder/CacheRecorder.cc @@ -61,7 +61,7 @@ CacheRecorder::CacheRecorder(uint8_t* uncompressed_trace, CacheRecorder::~CacheRecorder() { if (m_uncompressed_trace != NULL) { - delete m_uncompressed_trace; + delete [] m_uncompressed_trace; m_uncompressed_trace = NULL; } m_seq_map.clear(); diff --git a/src/mem/ruby/system/System.cc b/src/mem/ruby/system/System.cc index 0e52df2ec..617788b99 100644 --- a/src/mem/ruby/system/System.cc +++ b/src/mem/ruby/system/System.cc @@ -331,7 +331,7 @@ RubySystem::unserialize(Checkpoint *cp, const string §ion) memory_trace_size); m_mem_vec_ptr->populatePages(uncompressed_trace); - delete uncompressed_trace; + delete [] uncompressed_trace; uncompressed_trace = NULL; }