Skip to content

Fix memory leak in ValidateSchema #2473

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Manual Inputs
on:
workflow_dispatch:
inputs:
version:
description: Bump Version
default: v1.0.0
required: true
jobs:
bump-version:
name: Bump Package Version
runs-on: ubuntu-latest
steps:
- name: Example variable usage
run: git tag ${{ github.event.inputs.version }}
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ v3.x.y - YYYY-MMM-DD (to be released)
-------------------------------------


- Fix memory leak in ValidateSchema
[#2469 - @martinhsv]
- Using a custom VariableMatch* implementation
[#2428 - @zimmerle]
- Avoids to cleanup GeoIp on ModSecurity destructor
Expand Down
4 changes: 4 additions & 0 deletions src/operators/validate_schema.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ bool ValidateSchema::evaluate(Transaction *transaction,
return true;
}

if (m_validCtx != NULL) {
xmlSchemaFreeValidCtxt(m_validCtx);
m_validCtx = NULL;
}
m_validCtx = xmlSchemaNewValidCtxt(m_schema);
if (m_validCtx == NULL) {
std::stringstream err("XML: Failed to create validation context.");
Expand Down