Fix memory leak in streams

This commit is contained in:
Vincent Loup 2022-04-14 16:27:49 +02:00
parent 03ec81d86f
commit bc8662b0d5
2 changed files with 17 additions and 0 deletions

View File

@ -1,6 +1,8 @@
DD mmm YYYY - 2.9.x (to be released)
-------------------
* Fix memory leak in streams
[Issue #2208 - @marcstern, @vloup, @JamesColeman-LW]
* mlogc log-line parsing fails due to enhanced timestamp
[Issue #2682 - @bozhinov, @ABrauer-CPT, @martinhsv]
* Allow no-key, single-value JSON body

View File

@ -325,6 +325,21 @@ static apr_status_t modsecurity_tx_cleanup(void *data) {
#endif
#endif
/* Streams cleanup. */
if (msr->stream_input_data != NULL) {
free(msr->stream_input_data);
msr->stream_input_data = NULL;
msr->stream_input_length = 0;
#ifdef MSC_LARGE_STREAM_INPUT
msr->stream_input_allocated_length = 0;
#endif
}
if (msr->stream_output_data != NULL) {
free(msr->stream_output_data);
msr->stream_output_data = NULL;
msr->stream_output_length = 0;
}
return APR_SUCCESS;
}