struct state_event *ev_st = zalloc(sizeof(*ev_st));
size_t value_len = strlen(value);
+ if (!ev_st)
+ return NULL;
ev_st->value = val;
ev_st->name = zalloc(sizeof(char) * value_len + 1);
+ if (!ev_st->name) {
+ free(ev_st);
+ return NULL;
+ }
memcpy(ev_st->name, value, value_len);
return ev_st;
return;
ev_st = ivi_policy_state_event_create(state, value);
+ if (!ev_st)
+ return;
wl_list_insert(&policy->states, &ev_st->link);
}
return;
ev_st = ivi_policy_state_event_create(ev, value);
+ if (!ev_st)
+ return;
wl_list_insert(&policy->events, &ev_st->link);
}
for (uint32_t i = 0; i < ARRAY_LENGTH(default_states); i ++) {
struct state_event *ev_st =
ivi_policy_state_event_create(i, default_states[i]);
+ if (!ev_st)
+ return;
wl_list_insert(&policy->states, &ev_st->link);
}
}
for (uint32_t i = 0; i < ARRAY_LENGTH(default_events); i ++) {
struct state_event *ev_st =
ivi_policy_state_event_create(i, default_events[i]);
+ if (!ev_st)
+ return;
wl_list_insert(&policy->events, &ev_st->link);
}
}
{
struct ivi_policy *policy = zalloc(sizeof(*policy));
+ if (!policy)
+ return NULL;
policy->user_data = user_data;
policy->ivi = ivi;
policy->state_change_in_progress = false;
return -1;
}
- a_policy = zalloc(sizeof(*a_policy));
- if (!a_policy)
- return -1;
-
if (policy->state_change_in_progress)
return -1;
if (!ivi_policy_state_is_known(state, policy))
return -1;
+ a_policy = zalloc(sizeof(*a_policy));
+ if (!a_policy)
+ return -1;
+
app_id_len = strlen(app_id);
a_policy->app_id = zalloc(sizeof(char) * app_id_len + 1);
+ if (!a_policy->app_id) {
+ free(a_policy);
+ return -1;
+ }
memcpy(a_policy->app_id, app_id, app_id_len);
a_policy->state = state;