mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-30 00:00:16 +01:00
vhost protocol timer: dont leak the object containing the sul
Converting the vhost-protocol timer to sul was correct, but we don't clean up the object containing the sul after the timer fires, causing a leak.
This commit is contained in:
parent
d3aa28c2db
commit
dede242a4f
1 changed files with 5 additions and 3 deletions
|
@ -190,8 +190,8 @@ lws_set_timeout_us(struct lws *wsi, enum pending_timeout reason, lws_usec_t us)
|
||||||
int
|
int
|
||||||
__lws_timed_callback_remove(struct lws_vhost *vh, struct lws_timed_vh_protocol *p)
|
__lws_timed_callback_remove(struct lws_vhost *vh, struct lws_timed_vh_protocol *p)
|
||||||
{
|
{
|
||||||
lws_start_foreach_llp(struct lws_timed_vh_protocol **, pt,
|
lws_start_foreach_llp_safe(struct lws_timed_vh_protocol **, pt,
|
||||||
vh->timed_vh_protocol_list) {
|
vh->timed_vh_protocol_list, next) {
|
||||||
if (*pt == p) {
|
if (*pt == p) {
|
||||||
*pt = p->next;
|
*pt = p->next;
|
||||||
lws_dll2_remove(&p->sul.list);
|
lws_dll2_remove(&p->sul.list);
|
||||||
|
@ -199,7 +199,7 @@ __lws_timed_callback_remove(struct lws_vhost *vh, struct lws_timed_vh_protocol *
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} lws_end_foreach_llp(pt, next);
|
} lws_end_foreach_llp_safe(pt);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -221,6 +221,8 @@ lws_sul_timed_callback_vh_protocol_cb(lws_sorted_usec_list_t *sul)
|
||||||
tvp->vhost->name, tvp->protocol->name, tvp->reason);
|
tvp->vhost->name, tvp->protocol->name, tvp->reason);
|
||||||
|
|
||||||
tvp->protocol->callback(pt->fake_wsi, tvp->reason, NULL, NULL, 0);
|
tvp->protocol->callback(pt->fake_wsi, tvp->reason, NULL, NULL, 0);
|
||||||
|
|
||||||
|
__lws_timed_callback_remove(tvp->vhost, tvp);
|
||||||
}
|
}
|
||||||
|
|
||||||
LWS_VISIBLE LWS_EXTERN int
|
LWS_VISIBLE LWS_EXTERN int
|
||||||
|
|
Loading…
Add table
Reference in a new issue