From 970943a5c8124619633c1c44f9e33cb51805d004 Mon Sep 17 00:00:00 2001 From: MBaesken Date: Thu, 20 Jun 2024 13:56:32 +0200 Subject: [PATCH] JDK-8333361 --- .../serviceability/jvmti/HeapMonitor/libHeapMonitorTest.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/libHeapMonitorTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/libHeapMonitorTest.cpp index 035aaef827e34..b70f4834f23d2 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/libHeapMonitorTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/libHeapMonitorTest.cpp @@ -515,7 +515,9 @@ static void event_storage_augment_storage(EventStorage* storage) { ObjectTrace** new_objects = reinterpret_cast(malloc(new_max * sizeof(*new_objects))); int current_count = storage->live_object_count; - memcpy(new_objects, storage->live_objects, current_count * sizeof(*new_objects)); + if (storage->live_objects != nullptr) { + memcpy(new_objects, storage->live_objects, current_count * sizeof(*new_objects)); + } free(storage->live_objects); storage->live_objects = new_objects; storage->live_object_size = new_max;