Skip to content

Commit ed14906

Browse files
committed
8333361: ubsan,test : libHeapMonitorTest.cpp:518:9: runtime error: null pointer passed as argument 2, which is declared to never be null
Reviewed-by: asteiner, lucy, amenkov
1 parent bdd9660 commit ed14906

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/libHeapMonitorTest.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,9 @@ static void event_storage_augment_storage(EventStorage* storage) {
515515
ObjectTrace** new_objects = reinterpret_cast<ObjectTrace**>(malloc(new_max * sizeof(*new_objects)));
516516

517517
int current_count = storage->live_object_count;
518-
memcpy(new_objects, storage->live_objects, current_count * sizeof(*new_objects));
518+
if (storage->live_objects != nullptr) {
519+
memcpy(new_objects, storage->live_objects, current_count * sizeof(*new_objects));
520+
}
519521
free(storage->live_objects);
520522
storage->live_objects = new_objects;
521523
storage->live_object_size = new_max;

0 commit comments

Comments
 (0)