diff options
author | Sangyoon Jang <jeremy.jang@samsung.com> | 2024-07-01 09:53:18 +0900 |
---|---|---|
committer | Sangyoon Jang <jeremy.jang@samsung.com> | 2024-07-01 10:46:09 +0900 |
commit | 638971d2863372b620f4521465fee0968bba8463 (patch) | |
tree | 219a22f10c4bb5961eb45d97f8ca866d256fe35a | |
parent | 47c0cd78b23ff9b874edaa273d5ba241b535da42 (diff) | |
download | slp-pkgmgr-638971d2863372b620f4521465fee0968bba8463.tar.gz slp-pkgmgr-638971d2863372b620f4521465fee0968bba8463.tar.bz2 slp-pkgmgr-638971d2863372b620f4521465fee0968bba8463.zip |
Fix static analysis issues
Change-Id: I28b5e004c229d4643612a6c1abedf4b260096ef5
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
-rw-r--r-- | client/src/api_stub.cc | 9 | ||||
-rw-r--r-- | installer/src/api_stub.cc | 9 |
2 files changed, 11 insertions, 7 deletions
diff --git a/client/src/api_stub.cc b/client/src/api_stub.cc index 16b01ff..7547c96 100644 --- a/client/src/api_stub.cc +++ b/client/src/api_stub.cc @@ -2050,10 +2050,11 @@ API int pkgmgr_client_res_usr_uninstall(pkgmgr_client *pc, const char *pkgid, } API pkgmgr_res_event_info *pkgmgr_res_event_info_new() { - pkgmgr_res_event_info* info = - reinterpret_cast<pkgmgr_res_event_info*>( - new rpc_port::PkgSignal::ExtraData); - if (!info) { + pkgmgr_res_event_info* info; + try { + info = reinterpret_cast<pkgmgr_res_event_info*>( + new rpc_port::PkgSignal::ExtraData); + } catch (const std::bad_alloc& e) { _E("Out of memory"); return nullptr; } diff --git a/installer/src/api_stub.cc b/installer/src/api_stub.cc index 5932cf6..59d76d9 100644 --- a/installer/src/api_stub.cc +++ b/installer/src/api_stub.cc @@ -47,12 +47,15 @@ API pkgmgr_installer* pkgmgr_installer_new() { _E("pkgmgr_installer_new fail"); return nullptr; } - - return nullptr; } API pkgmgr_installer* pkgmgr_installer_offline_new() { - return new pkgmgr::installer::Control(true); + try { + return new pkgmgr::installer::Control(true); + } catch (...) { + _E("pkgmgr_installer_offline_new fail"); + return nullptr; + } } API int pkgmgr_installer_free(pkgmgr_installer* pi) { |