Fix coverty issues 64/258764/1
authoranuj.bhumiya <anuj.bhumiya@samsung.com>
Tue, 25 May 2021 08:58:41 +0000 (14:28 +0530)
committeranuj.bhumiya <anuj.bhumiya@samsung.com>
Tue, 25 May 2021 08:58:41 +0000 (14:28 +0530)
Change-Id: I06b246df43582a066d071b899558b9a39b9be57d
Signed-off-by: anuj.bhumiya <anuj.bhumiya@samsung.com>
bt-api/bt-event-handler.c
bt-oal/bluez_hal/src/bt-hal-gatt-server.c
bt-oal/bluez_hal/src/bt-hal-mesh-dbus-handler.c
bt-service/services/mesh/bt-service-mesh-cdb.c

index f4e56e1..e1396b7 100644 (file)
@@ -3733,6 +3733,8 @@ static void __bt_otp_event_filter(GDBusConnection *connection,
                BT_DBG("Fd  [%d]", fd);
 
                otc_info = g_malloc0(sizeof(bluetooth_otc_info_t));
+               if (!otc_info)
+                       return;
                otc_info->fd = fd;
                otc_info->connected = connected;
                otc_info->address = g_strdup(address);
index 0dbdce5..376fbe6 100644 (file)
@@ -2803,6 +2803,7 @@ static bt_status_t gatt_server_add_descriptor(int slot, int service_handle, bt_u
        desc_handle = __bt_hal_assign_gatt_handle(BT_GATT_TYPE_DESC);
        if (desc_handle == -1) {
                ERR("Too many gatt desc handles are created");
+               g_strfreev(line_argv);
                g_free(serv_path);
                return BT_STATUS_FAIL;
        }
index 14b60f2..be91742 100644 (file)
@@ -428,6 +428,7 @@ static gint __compare_dbus_path(gconstpointer data, gconstpointer user_data)
        }
        char **strings =  g_strsplit(path, "/elem", 2);
        ret = g_strcmp0(strings[0], app->path);
+       g_strfreev(strings);
        return ret;
 }
 
index c3abc19..cdf1ab8 100644 (file)
@@ -1609,8 +1609,10 @@ bool _bt_mesh_conf_add_model_config_data(_bt_mesh_cdb_t *cfg, uint16_t unicast,
        if (!jgroup)
                return false;
 
-       if (!__mesh_write_uint16_hex(jgroup, "sub-addr", group_addr))
+       if (!__mesh_write_uint16_hex(jgroup, "sub-addr", group_addr)) {
+               json_object_put(jgroup);
                return false;
+       }
 
        json_object_array_add(jgroups, jgroup);
 
@@ -1727,8 +1729,10 @@ bool _bt_mesh_conf_overwrite_model_config_data(_bt_mesh_cdb_t *cfg, uint16_t uni
        if (!jgroup)
                return false;
 
-       if (!__mesh_write_uint16_hex(jgroup, "sub-addr", group_addr))
+       if (!__mesh_write_uint16_hex(jgroup, "sub-addr", group_addr)) {
+               json_object_put(jgroup);
                return false;
+       }
 
        json_object_array_add(jgroups, jgroup);