1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

lws_context_create: clean up cancel pipes on fail

https://github.com/warmcat/libwebsockets/issues/1765
This commit is contained in:
Andy Green 2019-11-16 16:55:09 +00:00
parent f04d18b5da
commit 3de710e223

View file

@ -490,10 +490,7 @@ lwsl_info("context created\n");
#if defined(LWS_WITH_PEER_LIMITS)
lws_free_set_NULL(context->pl_hash_table);
#endif
lws_free_set_NULL(context->pt[0].fds);
lws_plat_context_late_destroy(context);
lws_free_set_NULL(context);
return NULL;
goto fail_clean_pipes;
}
lws_context_init_extensions(info, context);
@ -538,6 +535,18 @@ lwsl_info("context created\n");
return context;
#if defined(LWS_WITH_NETWORK)
fail_clean_pipes:
for (n = 0; n < context->count_threads; n++)
lws_destroy_event_pipe(context->pt[n].pipe_wsi);
lws_free_set_NULL(context->pt[0].fds);
lws_plat_context_late_destroy(context);
lws_free_set_NULL(context);
return NULL;
#endif
bail:
lws_context_destroy(context);