Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

detect memory leaks with mbedtls-3.5 #3177

Open
xuchao0915170 opened this issue Jul 3, 2024 · 3 comments
Open

detect memory leaks with mbedtls-3.5 #3177

xuchao0915170 opened this issue Jul 3, 2024 · 3 comments

Comments

@xuchao0915170
Copy link

Hi,

I built lws-4.3-stable with mbedtls-3.5.2, ASAN option OPEN.
When I ran the lws-minimal-ws-client-ping demo,I found a memory leak warning below:
image
Then I rebuilt the lws demo with mbedtls-3.2.1, the warning is gone, so I guess this is a new version adapting problem.
I tried several ways to fix it but failed, so I report this issue instead, hope it will help~

@lws-team
Copy link
Member

lws-team commented Jul 3, 2024

Does the problem still exist on main branch? It sounds like an internal allocation from mbedtls side that either didn't used to exist or was freed somewhere else before exit on earlier versions.

There's this but doesn't seem like a great fit Mbed-TLS/mbedtls#3486

@xuchao0915170
Copy link
Author

I tried the newest develop version(mbedtls-3.6), the memory leak still exists:
image

@lws-team
Copy link
Member

lws-team commented Jul 4, 2024

This really seems like a change in mbedtls allocating something in its entropy function that now has to be freed in a step we didn't have to do on mbedtls earlier than 3.5. You're better off asking mbedtls since without a crystal ball we can't know that later versions of mbedtls than exist at the time we integrated them are later going to start doing that.

They should tell you that "you now need to free those allocations by calling xxx" and then you can provide a patch on lws to do that (preferably included after checking MBEDTLS version requires it).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants