summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChanggyu Choi <changyu.choi@samsung.com>2020-11-12 11:03:13 +0900
committerChanggyu Choi <changyu.choi@samsung.com>2020-11-12 11:10:15 +0900
commiteb51138833369596099c5196c7c9fb1caf96f820 (patch)
treecdb08d82b6c49e275eda70004d91cce8e3c7259f
parente645bd58355af4b4af3a0d8a21590313a94af98f (diff)
downloadnotification-eb51138833369596099c5196c7c9fb1caf96f820.tar.gz
notification-eb51138833369596099c5196c7c9fb1caf96f820.tar.bz2
notification-eb51138833369596099c5196c7c9fb1caf96f820.zip
Fix static analysis issues
Change-Id: I02163c95b0bda034b73b59c3ee6bf8a5f667b132 Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
-rw-r--r--notification-ex/stub.cc10
-rw-r--r--notification/src/notification_shared_file.c8
2 files changed, 15 insertions, 3 deletions
diff --git a/notification-ex/stub.cc b/notification-ex/stub.cc
index 7d523e6..f79ebdb 100644
--- a/notification-ex/stub.cc
+++ b/notification-ex/stub.cc
@@ -1347,6 +1347,8 @@ extern "C" EXPORT_API int noti_ex_padding_create(noti_ex_padding_h *handle,
new (std::nothrow) Padding(left, top, right, bottom));
if (ptr == nullptr || ptr->get() == nullptr) {
LOGE("Out-of-memory");
+ if (ptr != nullptr)
+ delete(ptr);
return NOTI_EX_ERROR_OUT_OF_MEMORY;
}
@@ -1430,6 +1432,8 @@ extern "C" EXPORT_API int noti_ex_geometry_create(noti_ex_geometry_h *handle,
new (std::nothrow) Geometry(x, y, w, h));
if (ptr == nullptr || ptr->get() == nullptr) {
LOGE("Out-of-memory");
+ if (ptr != nullptr)
+ delete ptr;
return NOTI_EX_ERROR_OUT_OF_MEMORY;
}
@@ -1522,6 +1526,8 @@ extern "C" EXPORT_API int noti_ex_style_create(noti_ex_style_h *handle,
new (std::nothrow) Style(col, padd, geo));
if (ptr == nullptr || ptr->get() == nullptr) {
LOGE("Out-of-memory");
+ if (ptr != nullptr)
+ delete ptr;
return NOTI_EX_ERROR_OUT_OF_MEMORY;
}
@@ -1651,6 +1657,8 @@ extern "C" EXPORT_API int noti_ex_style_get_geometry(noti_ex_style_h handle,
new (std::nothrow) Geometry(*((*p)->GetGeometry())));
if (geo == nullptr || geo->get() == nullptr) {
LOGE("Out-of-memory");
+ if (geo != nullptr)
+ delete geo;
return NOTI_EX_ERROR_OUT_OF_MEMORY;
}
@@ -2143,6 +2151,8 @@ extern "C" EXPORT_API int noti_ex_item_get_style(noti_ex_item_h handle,
auto* ptr = new (std::nothrow) shared_ptr<Style>(new (std::nothrow) Style(*s));
if (ptr == nullptr || ptr->get() == nullptr) {
LOGE("Out of memory");
+ if (ptr != nullptr)
+ delete ptr;
return NOTI_EX_ERROR_OUT_OF_MEMORY;
}
diff --git a/notification/src/notification_shared_file.c b/notification/src/notification_shared_file.c
index 9a585f2..c86cdeb 100644
--- a/notification/src/notification_shared_file.c
+++ b/notification/src/notification_shared_file.c
@@ -1238,9 +1238,11 @@ out:
tmp_list = g_list_find_custom(__uid_list, GINT_TO_POINTER(req_data->uid),
__comp_uid_info_list);
- uid_info = tmp_list->data;
- uid_info->sharing_req_list = g_list_remove(uid_info->sharing_req_list,
- req_data);
+ if (tmp_list != NULL) {
+ uid_info = tmp_list->data;
+ uid_info->sharing_req_list = g_list_remove(
+ uid_info->sharing_req_list, req_data);
+ }
__free_req_info(req_data);
return FALSE;