libwebsockets icon indicating copy to clipboard operation
libwebsockets copied to clipboard

Leaking fds when creating / destroying `lws_context` instances

Open ERobsham opened this issue 3 years ago • 4 comments

While investigating a port leak crash in software I maintain, I found that the source of the leak was due to the file descriptors returned by pipe() call in lws_plat_pipe_create() not getting cleaned up in the lws_context_destroy() call.

This can be easily reproduced by just recreating connections (running lws_context_create() / lws_context_destroy() multiple times in the same program).

I created an example client that I was using to debug the leak / test a fix in this branch.

Will be putting in a PR for a potential fix shortly.

ERobsham avatar Oct 19 '22 22:10 ERobsham

PR for the Potential fix: https://github.com/warmcat/libwebsockets/pull/2745

ERobsham avatar Oct 19 '22 22:10 ERobsham