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:56:27 +00:00
parent 285fb9c8ba
commit 297aa86b60

View file

@ -727,10 +727,7 @@ lws_create_context(const struct lws_context_creation_info *info)
#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);
@ -765,6 +762,18 @@ lws_create_context(const struct lws_context_creation_info *info)
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);