Skip to content

Commit ae98302

Browse files
committed
Fix memory leak in streams
1 parent 1dd1c6d commit ae98302

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 memory leak that occurs on JSON parsing error
57
[Issue #2236 @argenet, @vloup, @martinhsv]
68
* Multipart names/filenames may include single quote if double-quote enclosed

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)