When updating runtime data for service already having previous data, the
call to service_data_trigger() will indirectly access the just freed
`s->data` memory through the `s->data_blob` AVL structure.
Fix this issue by moving the call to `service_data_trigger()` before the
freeing of `s->data`.
Signed-off-by: Jo-Philipp Wich <[email protected]>
if (blob_attr_equal(s->data, data))
return 0;
+ service_data_trigger(&s->data_blob);
+ blobmsg_list_free(&s->data_blob);
+
free(s->data);
s->data = blob_memdup(data);
if (!s->data)
return -1;
- service_data_trigger(&s->data_blob);
- blobmsg_list_free(&s->data_blob);
blobmsg_list_fill(&s->data_blob, blobmsg_data(s->data),
blobmsg_data_len(s->data), false);
service_data_trigger(&s->data_blob);