8262466: linux libsaproc/DwarfParser.cpp delete DwarfParser object in early return

Reviewed-by: ysuenaga, kevinw
This commit is contained in:
Matthias Baesken 2021-03-03 07:41:01 +00:00
parent c15801e98c
commit 0265ab63e4

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, NTT DATA.
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2021, NTT DATA.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -99,14 +99,13 @@ JNIEXPORT void JNICALL Java_sun_jvm_hotspot_debugger_linux_amd64_DwarfParser_ini
extern "C"
JNIEXPORT jlong JNICALL Java_sun_jvm_hotspot_debugger_linux_amd64_DwarfParser_createDwarfContext
(JNIEnv *env, jclass this_cls, jlong lib) {
jlong result = 0L;
DwarfParser *parser = new DwarfParser(reinterpret_cast<lib_info *>(lib));
if (!parser->is_parseable()) {
jclass ex_cls = env->FindClass("sun/jvm/hotspot/debugger/DebuggerException");
if (!env->ExceptionOccurred()) {
env->ThrowNew(ex_cls, "DWARF not found");
}
delete parser;
return 0L;
}