e_test_event: fix issue detected by static analysis tool 11/313611/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Fri, 28 Jun 2024 07:24:24 +0000 (16:24 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Fri, 28 Jun 2024 07:24:24 +0000 (16:24 +0900)
Change-Id: I3a42e7a803b5f87c8ec501bddf3b4e4cdf6f8364
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/e_test_event.cpp

index 3de997744c9d612701d3909c1d7f0ff5cca694a8..b69c8fd0880ff7fa1736ba9f87892af5f9a8c15e 100644 (file)
@@ -1905,6 +1905,7 @@ _cb_method_win_info_list_get(void *data,
    Eldbus_Message_Iter *array = NULL, *ec = NULL;
    Window_Info_List *info_list = (Window_Info_List *)data;
    Eina_Bool res = EINA_FALSE, animating = EINA_FALSE;
+   etWin *tw = NULL;
 
    if (info_list == NULL)
      goto finish;
@@ -1917,8 +1918,15 @@ _cb_method_win_info_list_get(void *data,
 
    while (eldbus_message_iter_get_and_next(array, 'r', &ec))
      {
-        etWin *tw = new etWin();
-        if (!tw) continue;
+        try
+          {
+             tw = new etWin();
+          }
+        catch (std::bad_alloc &e)
+          {
+             ERR("Failed to allocate memory for etWin");
+             continue;
+          }
 
         res = eldbus_message_iter_arguments_get(
            ec,