diff --git a/android/gatt.c b/android/gatt.c
index 33eeba9..7f95226 100644
--- a/android/gatt.c
+++ b/android/gatt.c
struct notification_data *notification = data;
struct gatt_app *app;
+ if (!notification)
+ return;
+
if (--notification->ref)
return;
{
struct gatt_app *app = data;
+ if (!app)
+ return;
+
/*
* First we want to get all notifications and unregister them.
* We don't pass unregister_notification to queue_destroy,
{
struct pending_request *entry = data;
+ if (!entry)
+ return;
+
free(entry->value);
free(entry->filter_value);
free(entry);
{
struct app_connection *conn = data;
+ if (!conn)
+ return;
+
if (conn->timeout_id > 0)
g_source_remove(conn->timeout_id);
/* TODO: should we care to match also bdaddr when conn_id is unique? */
conn = queue_remove_if(app_connections, match_connection_by_id,
INT_TO_PTR(cmd->conn_id));
- if (conn)
- destroy_connection(conn);
+ destroy_connection(conn);
status = HAL_STATUS_SUCCESS;
case GATT_CLIENT_TEST_CMD_DISCONNECT:
app = queue_find(gatt_apps, match_app_by_id,
INT_TO_PTR(test_client_if));
- if (app)
- queue_remove_all(app_connections,
- match_connection_by_app, app,
- destroy_connection);
+ queue_remove_all(app_connections, match_connection_by_app, app,
+ destroy_connection);
status = HAL_STATUS_SUCCESS;
break;
/* TODO: should we care to match also bdaddr when conn_id is unique? */
conn = queue_remove_if(app_connections, match_connection_by_id,
INT_TO_PTR(cmd->conn_id));
- if (conn)
- destroy_connection(conn);
+ destroy_connection(conn);
status = HAL_STATUS_SUCCESS;
adl = att_data_list_alloc(queue_length(temp),
sizeof(uint16_t) + length);
- if (val)
- destroy_pending_request(val);
+ destroy_pending_request(val);
val = queue_pop_head(temp);
while (val) {