# HG changeset patch # User mlarsson # Date 1519815902 -3600 # Node ID bd1bfa4e563fc76119d06ee36644c80aae566f97 # Parent fde9b3c56de496d5304bb1e69f208d8b7061351d 8198825: Resolve missing review feedback for JDK-8170976 Reviewed-by: rehn, lfoltan, hseigel diff -r fde9b3c56de4 -r bd1bfa4e563f test/hotspot/gtest/logging/logTestFixture.cpp --- a/test/hotspot/gtest/logging/logTestFixture.cpp Wed Feb 28 10:37:02 2018 +0100 +++ b/test/hotspot/gtest/logging/logTestFixture.cpp Wed Feb 28 12:05:02 2018 +0100 @@ -31,7 +31,7 @@ #include "unittest.hpp" #include "utilities/ostream.hpp" -LogTestFixture::LogTestFixture() { +LogTestFixture::LogTestFixture() : _configuration_snapshot(NULL), _n_snapshots(0) { // Set up TestLogFileName to include PID, testcase name and test name int ret = jio_snprintf(_filename, sizeof(_filename), "testlog.pid%d.%s.%s.log", os::current_process_id(), @@ -45,6 +45,7 @@ LogTestFixture::~LogTestFixture() { restore_config(); + clear_snapshot(); delete_file(TestLogFileName); } @@ -65,6 +66,7 @@ } void LogTestFixture::snapshot_config() { + clear_snapshot(); _n_snapshots = LogConfiguration::_n_outputs; _configuration_snapshot = NEW_C_HEAP_ARRAY(char*, _n_snapshots, mtLogging); for (size_t i = 0; i < _n_snapshots; i++) { @@ -103,3 +105,16 @@ set_log_config(name, selection, decorators, options != NULL ? options : ""); } } + +void LogTestFixture::clear_snapshot() { + if (_configuration_snapshot == NULL) { + return; + } + assert(_n_snapshots > 0, "non-null array should have at least 1 element"); + for (size_t i = 0; i < _n_snapshots; i++) { + os::free(_configuration_snapshot[i]); + } + FREE_C_HEAP_ARRAY(char*, _configuration_snapshot); + _configuration_snapshot = NULL; + _n_snapshots = 0; +} diff -r fde9b3c56de4 -r bd1bfa4e563f test/hotspot/gtest/logging/logTestFixture.hpp --- a/test/hotspot/gtest/logging/logTestFixture.hpp Wed Feb 28 10:37:02 2018 +0100 +++ b/test/hotspot/gtest/logging/logTestFixture.hpp Wed Feb 28 12:05:02 2018 +0100 @@ -49,5 +49,6 @@ void snapshot_config(); void restore_config(); + void clear_snapshot(); };