Author: Andy Green Date: Sun Oct 04 08:36:36 2026 +0100 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 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;