mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-07 02:02:54 +03:00
coap_resource.c: Fix reference to deleted Observe after transmit failure
This commit is contained in:
1 parent
27f8e127ed
commit
9fc4d35cb2
1 file changed
+17
-2
+17
-2
@@ -1357,10 +1357,25 @@ coap_notify_observers(coap_context_t *context, coap_resource_t *r,
|
||||
#if COAP_Q_BLOCK_SUPPORT
|
||||
finish:
|
||||
#endif /* COAP_Q_BLOCK_SUPPORT */
|
||||
if (COAP_INVALID_MID == mid && obs) {
|
||||
if (COAP_INVALID_MID == mid) {
|
||||
coap_log_debug("* %s: coap_check_notify: sending failed, resource stays "
|
||||
"partially dirty\n", coap_session_str(obs_session));
|
||||
obs->dirty = 1;
|
||||
if (obs) {
|
||||
coap_subscription_t *s;
|
||||
/*
|
||||
* obs may have been deleted in coap_send_internal() or
|
||||
* coap_send_q_block2().
|
||||
*/
|
||||
LL_FOREACH(r->subscribers, s) {
|
||||
if (s == obs) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (s == NULL)
|
||||
obs = NULL;
|
||||
}
|
||||
if (obs)
|
||||
obs->dirty = 1;
|
||||
r->partiallydirty = 1;
|
||||
}
|
||||
goto cleanup;
|
||||
|
||||
Reference in new issue
Block a user