in->respawn_retry = vals[2];
}
if (tb[INSTANCE_ATTR_TRIGGER]) {
- in->trigger = malloc(blob_pad_len(tb[INSTANCE_ATTR_TRIGGER]));
+ in->trigger = blob_memdup(tb[INSTANCE_ATTR_TRIGGER]);
if (!in->trigger)
return -1;
- memcpy(in->trigger, tb[INSTANCE_ATTR_TRIGGER], blob_pad_len(tb[INSTANCE_ATTR_TRIGGER]));
trigger_add(in->trigger, in);
}
service_validate_del(s);
if (tb[SERVICE_SET_TRIGGER] && blobmsg_data_len(tb[SERVICE_SET_TRIGGER])) {
- s->trigger = malloc(blob_pad_len(tb[SERVICE_SET_TRIGGER]));
+ s->trigger = blob_memdup(tb[SERVICE_SET_TRIGGER]);
if (!s->trigger)
return -1;
- memcpy(s->trigger, tb[SERVICE_SET_TRIGGER], blob_pad_len(tb[SERVICE_SET_TRIGGER]));
trigger_add(s->trigger, s);
}
continue;
if (!strcmp(t->type, type)) {
if (t->timeout) {
- t->data = malloc(blob_pad_len(data));
- memcpy(t->data, data, blob_pad_len(data));
+ t->data = blob_memdup(data);
uloop_timeout_set(&t->delay, t->timeout);
} else {
json_script_run(&t->jctx, "foo", data);