The bundle_dup() should not throw an exception. This patch adds
a missing exception handling.
Change-Id: I2131f7b29950805fa99de29c665f2adf7db9a73e
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
return nullptr;
}
- auto* h = reinterpret_cast<Bundle*>(b_from);
- auto* b = new (std::nothrow) Bundle(*h);
- if (b == nullptr) {
+ Bundle* b;
+ try {
+ auto* h = reinterpret_cast<Bundle*>(b_from);
+ b = new Bundle(*h);
+ } catch (const Exception& e) {
+ set_last_result(e.GetErrorCode());
+ return nullptr;
+ } catch (const std::bad_alloc& e) {
set_last_result(BUNDLE_ERROR_OUT_OF_MEMORY);
return nullptr;
}