diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2016-03-10 21:40:45 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2016-03-10 21:43:13 +0100 |
commit | eee4dd746ea3fc09d51d008446ec82e3de456eed (patch) | |
tree | a883cc057f95a72ceb808ee5e4cbd8e6d98bb7f3 /jvmfwk | |
parent | 8e9a7cac42d554402a6ead3a83ae8b7defc9247b (diff) |
Fix memory leaks
Change-Id: If9f7dc4a28d5e005959f0d4a0a2ed317b699f292
Diffstat (limited to 'jvmfwk')
-rw-r--r-- | jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx b/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx index ea2f846e9f25..9daf5740f1ba 100644 --- a/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx +++ b/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx @@ -64,8 +64,8 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) return -1; } - JavaInfo * pInfo = nullptr; - errcode = jfw_getSelectedJRE( & pInfo); + jfw::JavaInfoGuard pInfo; + errcode = jfw_getSelectedJRE(&pInfo.info); if (errcode != JFW_E_NONE && errcode != JFW_E_INVALID_SETTINGS) { @@ -73,19 +73,19 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) return -1; } - if (pInfo == nullptr) + if (pInfo.info == nullptr) { - if (!findAndSelect(&pInfo)) + if (!findAndSelect(&pInfo.info)) return -1; } else { //check if the JRE was not uninstalled sal_Bool bExist = sal_False; - errcode = jfw_existJRE(pInfo, &bExist); + errcode = jfw_existJRE(pInfo.info, &bExist); if (errcode == JFW_E_NONE) { - if (!bExist && !findAndSelect(&pInfo)) + if (!bExist && !findAndSelect(&pInfo.info)) return -1; } else @@ -95,9 +95,8 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) } } - OString sPaths = getLD_LIBRARY_PATH(pInfo->arVendorData); + OString sPaths = getLD_LIBRARY_PATH(pInfo.info->arVendorData); fprintf(stdout, "%s\n", sPaths.getStr()); - delete pInfo; } catch (const std::exception&) { |