Clean up timer while freeing client callback
@@ -995,6 +995,13 @@ free_client_cb(oc_client_cb_t *cb)
oc_memb_free(&client_cbs_s, cb);
}
+oc_event_callback_retval_t
+oc_ri_remove_client_cb(void *data)
+{
+ free_client_cb(data);
+ return DONE;
+}
+
void
oc_ri_remove_client_cb_by_mid(uint16_t mid)
{
@@ -1004,15 +1011,10 @@ oc_ri_remove_client_cb_by_mid(uint16_t mid)
break;
cb = cb->next;
}
- if (cb)
+ if (cb) {
+ oc_ri_remove_timed_event_callback(cb, &oc_ri_remove_client_cb);
free_client_cb(cb);
}
-
-oc_event_callback_retval_t
-oc_ri_remove_client_cb(void *data)
-{
- free_client_cb(data);
- return DONE;
}
oc_client_cb_t *
