Skip to content

Commit dd2d3f7

Browse files
authored
Merge pull request #2715 from vloup/memory-leak-fix-2208
Fix memory leak in streams
2 parents 5e1c131 + 08c0519 commit dd2d3f7

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Diff for: CHANGES

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
DD mmm YYYY - 2.9.x (to be released)
22
-------------------
33

4+
* Fix memory leak in streams
5+
[Issue #2208 - @marcstern, @vloup, @JamesColeman-LW]
46
* Fix: negative usec on log line when data type long is 32b
57
[Issue #2753 - @ABrauer-CPT, @martinhsv]
68
* mlogc log-line parsing fails due to enhanced timestamp

Diff for: apache2/modsecurity.c

+15
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,21 @@ static apr_status_t modsecurity_tx_cleanup(void *data) {
325325
#endif
326326
#endif
327327

328+
/* Streams cleanup. */
329+
if (msr->stream_input_data != NULL) {
330+
free(msr->stream_input_data);
331+
msr->stream_input_data = NULL;
332+
msr->stream_input_length = 0;
333+
#ifdef MSC_LARGE_STREAM_INPUT
334+
msr->stream_input_allocated_length = 0;
335+
#endif
336+
}
337+
if (msr->stream_output_data != NULL) {
338+
free(msr->stream_output_data);
339+
msr->stream_output_data = NULL;
340+
msr->stream_output_length = 0;
341+
}
342+
328343
return APR_SUCCESS;
329344
}
330345

0 commit comments

Comments
 (0)