From c9e4d9bba2b764c0cd40618df72ee66c56af8e28 Mon Sep 17 00:00:00 2001 From: "duna.oh" Date: Mon, 7 Nov 2022 17:20:01 +0900 Subject: [PATCH] e_devicemgr: fix the memory leak detected by static analysis tool Change-Id: I9733fb3941c67d6975f2d1572e0ecebacb86db63 --- src/bin/e_devicemgr_wl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bin/e_devicemgr_wl.c b/src/bin/e_devicemgr_wl.c index 55598f5..6e09a3e 100644 --- a/src/bin/e_devicemgr_wl.c +++ b/src/bin/e_devicemgr_wl.c @@ -154,6 +154,7 @@ e_devicemgr_wl_device_add(E_Devicemgr_Input_Device *dev) if (!res) { DMERR("Could not create tizen_input_device resource"); + wl_client_post_no_memory(wc); break; } @@ -161,6 +162,8 @@ e_devicemgr_wl_device_add(E_Devicemgr_Input_Device *dev) if (!device_user_data) { DMERR("Failed to allocate memory for input device user data\n"); + wl_client_post_no_memory(wc); + wl_resource_destroy(res); break; } device_user_data->dev = dev; @@ -579,6 +582,7 @@ _e_devicemgr_wl_cb_bind(struct wl_client *client, void *data, uint32_t version, { DMERR("Could not create tizen_input_device_manager_interface resource: %m"); wl_client_post_no_memory(client); + E_FREE(mgr_data); return; } @@ -607,12 +611,15 @@ _e_devicemgr_wl_cb_bind(struct wl_client *client, void *data, uint32_t version, if (!device_res) { DMERR("Could not create tizen_input_device resource: %m"); + wl_client_post_no_memory(client); return; } device_user_data = E_NEW(E_Devicemgr_Input_Device_User_Data, 1); if (!device_user_data) { DMERR("Failed to allocate memory for input device user data\n"); + wl_client_post_no_memory(client); + wl_resource_destroy(device_res); return; } device_user_data->dev = dev; -- 2.7.4