Skip to content

Fix memory leak of ValidateDTD's dtd object #2478

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 1 commit into from
Closed

Fix memory leak of ValidateDTD's dtd object #2478

wants to merge 1 commit into from

Conversation

martinhsv
Copy link
Contributor

@martinhsv martinhsv commented Dec 15, 2020

This pull request addresses the memory leak listed as 3) in #2469 .

With this pull request, xmlParseDTD() continues to be called for each call of evaluate().

However, the dtd pointer is now no longer a member variable of ValidateDTD. It is held indirectly by a resource-managing object that is itself a stack variable. The resource-managing object then ensures that xmlFreeDtd() when the stack variable goes out of scope and is destructed.

@zimmerle zimmerle self-requested a review December 16, 2020 13:22
@zimmerle zimmerle self-assigned this Dec 16, 2020
Copy link
Contributor

@zimmerle zimmerle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All perfect! Thank you! Merged!

public:
/** @ingroup ModSecurity_Operator */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This marking is further used by doxygen, in order to place this class under the operators sub class.

@zimmerle zimmerle added the 3.x Related to ModSecurity version 3.x label Dec 16, 2020
@zimmerle zimmerle closed this Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x Related to ModSecurity version 3.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants