Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
    npro  
 Modern all-safe Rust Network Protocol library supporting h1, h2, h3, ws, wt sans-IO and with socket IO + tls
git clone https://npro.rs/repo/npro
 
root / src / web / w-findings.c
Author[]Andy Green <andy@warmcat.com> 2026-10-04 07:36 UTC
Committer[]Andy Green <andy@warmcat.com> 2026-10-04 20:05 UTC
Treeb38d0a2e6e085ed6ff78019f914ae9748c91c0c6   Raw Patch
 
web: don't deref a NULL vhd at PROTOCOL_DESTROY
web: don't deref a NULL vhd at PROTOCOL_DESTROY

If PROTOCOL_INIT fails, lws frees the vhd but PROTOCOL_DESTROY still comes,
and we used it to close the event dbs regardless.  Same as sai-server had.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
diff --git a/src/web/w-comms.c b/src/web/w-comms.c index fa1bd45..aa151b5 100644 --- a/src/web/w-comms.c +++ b/src/web/w-comms.c @@ -417,6 +417,9 @@ w_callback_ws(struct lws *wsi, enum lws_callback_reasons reason, void *user, return 0; case LWS_CALLBACK_PROTOCOL_DESTROY: + /* we may have failed init, and lws freed the vhd */ + if (!vhd) + goto passthru; saiw_event_db_close_all_now(vhd); lws_struct_sq3_close(&vhd->pdb); goto passthru;
Page fetched 0s ago, creation time: 1ms (vhost etag hits: 0%, cache hits: 0%)