I just took the file from examples cookie_auth.c and mongoose.c, included the mongoose.h directory.
It crashes in console too. I use Visual Studio Enterprise 2015 14.0.
It crashes when I load the page on the navigator (chrome).
The callstack shows the crash on "get_session(http_message* hm) line 82 after a MG_EV_HTTP_REQUEST.
ucrtbased.dll!check_bytes(const unsigned char * const first, const unsigned char value, const unsigned int size) Line 194 C++
ucrtbased.dll!is_block_an_aligned_allocation(const void * const block) Line 251 C++
ucrtbased.dll!free_dbg_nolock(void * const block, const int block_use) Line 886 C++
ucrtbased.dll!_free_dbg(void * block, int block_use) Line 1030 C++
ucrtbased.dll!free(void * block) Line 28 C++
cooie_auth.exe!get_session(http_message * hm) Line 82 C
cooie_auth.exe!ev_handler(mg_connection * nc, int ev, void * p) Line 205 C
cooie_auth.exe!mg_call(mg_connection * nc, void(*)(mg_connection *, int, void ) ev_handler, void * user_data, int ev, void * ev_data) Line 2404 C
cooie_auth.exe!mg_http_call_endpoint_handler(mg_connection * nc, int ev, http_message * hm) Line 8822 C
cooie_auth.exe!mg_http_handler(mg_connection * nc, int ev, void * ev_data) Line 6629 C
cooie_auth.exe!mg_call(mg_connection * nc, void()(mg_connection *, int, void *) ev_handler, void * user_data, int ev, void * ev_data) Line 2404 C
cooie_auth.exe!mg_recv_tcp(mg_connection * nc, char * buf, unsigned int len) Line 2931 C
cooie_auth.exe!mg_do_recv(mg_connection * nc) Line 2887 C
cooie_auth.exe!mg_if_can_recv_cb(mg_connection * nc) Line 2893 C
cooie_auth.exe!mg_mgr_handle_conn(mg_connection * nc, int fd_flags, double now) Line 4009 C
cooie_auth.exe!mg_socket_if_poll(mg_iface * iface, int timeout_ms) Line 4200 C
cooie_auth.exe!mg_mgr_poll(mg_mgr * m, int timeout_ms) Line 2593 C
cooie_auth.exe!main() Line 261 C