-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Memory leak in modsecurity_request_body_to_stream() #2208
Comments
first malloc() in msre_op_rsub_execute() should also be replaced |
I found a better solution: free the memory in modsecurity_tx_cleanup(): |
Hi Marc, I just tested your fix against modsecurity 2.9.3 (Debian buster, I created a new patched deb file with quilt), and it seems you code compiles only if you run configure with A proper fix would be to ifdef the assignation of
|
Correct |
I pushed this code change on our environment on the 22nd at 12:00. Here is the memory plot that confirms that things got way better now. Instead of having a daily reboot of our modsec container due to memory leaks, we're seeing it way more stable with no restarts for the last 3 days. @zimmerle Do you wish to have a merge request for this? |
I think having a pull request would be great @vloup as in my testing it solves the issue. I've made a patch for our internal builds of mod_security2, which we will be deploying to our customers shortly. |
@JamesColeman-LW a PR has been opened. |
Closed via #2715 . Thanks all. |
msr->stream_input_data buffer is never unallocated, leading to a memory leak on each request.
We should use the request memory pool.
This needs passing the pool as parameter in modsecurity_request_body_to_stream() and in read_request_body(). The request memory pool is available when calling read_request_body() (in hook_request_late() ).
The text was updated successfully, but these errors were encountered: