Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
8284458: CodeHeapState::aggregate() leaks blob_name
Backport-of: d4a48843856e3d80a58d5a0a26dff6c4d349dca9
  • Loading branch information
zhengyu123 committed Apr 27, 2022
1 parent b2418d8 commit 6b0bcaf
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/hotspot/share/code/codeHeapState.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2019 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -756,18 +756,17 @@ void CodeHeapState::aggregate(outputStream* out, CodeHeap* heap, size_t granular
CodeBlob* cb = (CodeBlob*)heap->find_start(h);
cbType = get_cbType(cb); // Will check for cb == NULL and other safety things.
if (cbType != noType) {
const char* blob_name = os::strdup(cb->name());
const char* blob_name = nullptr;
unsigned int nm_size = 0;
int temperature = 0;
nmethod* nm = cb->as_nmethod_or_null();
if (nm != NULL) { // no is_readable check required, nm = (nmethod*)cb.
ResourceMark rm;
Method* method = nm->method();
if (nm->is_in_use()) {
blob_name = os::strdup(method->name_and_sig_as_C_string());
}
if (nm->is_not_entrant()) {
if (nm->is_in_use() || nm->is_not_entrant()) {
blob_name = os::strdup(method->name_and_sig_as_C_string());
} else {
blob_name = os::strdup(cb->name());
}

nm_size = nm->total_size();
Expand Down Expand Up @@ -815,6 +814,8 @@ void CodeHeapState::aggregate(outputStream* out, CodeHeap* heap, size_t granular
default:
break;
}
} else {
blob_name = os::strdup(cb->name());
}

//------------------------------------------
Expand Down

1 comment on commit 6b0bcaf

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.