diff --git a/android/health.c b/android/health.c
index 0462e99..7553467 100644
--- a/android/health.c
+++ b/android/health.c
goto fail;
}
+ app->mdeps = queue_new();
+ if (!app->mdeps)
+ goto fail;
+
+ app->devices = queue_new();
+ if (!app->devices)
+ goto fail;
+
return app;
fail:
memcpy(mdep->descr, cmd->descr, cmd->descr_len);
}
- if (app->num_of_mdep > 0 && !app->mdeps) {
- app->mdeps = queue_new();
- if (!app->mdeps) {
- status = HAL_STATUS_FAILED;
- goto fail;
- }
- }
-
if (!queue_push_tail(app->mdeps, mdep)) {
status = HAL_STATUS_FAILED;
goto fail;
android2bdaddr(addr, &dev->dst);
dev->app_id = app_id;
+ dev->channels = queue_new();
+ if (!dev->channels) {
+ free_health_device(dev);
+ return NULL;
+ }
return dev;
}
channel->dev = dev;
- if (!app->devices) {
- app->devices = queue_new();
- if (!app->devices)
- goto fail;
- }
-
if (!queue_push_tail(app->devices, dev))
goto fail;
- if (!dev->channels) {
- dev->channels = queue_new();
- if (!dev->channels)
- goto fail;
- }
-
if (!queue_push_tail(dev->channels, channel)) {
queue_remove(app->devices, dev);
goto fail;