Skip to content

Commit

Permalink
Merge pull request #3014 from martinhsv/v3/master
Browse files Browse the repository at this point in the history
Fix: validateDTD compile fails if when libxml2 not installed
  • Loading branch information
martinhsv committed Nov 7, 2023
2 parents cb4d7ae + c11b282 commit 5b094c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
v3.x.y - YYYY-MMM-DD (to be released)
-------------------------------------

- Fix: validateDTD compile fails if when libxml2 not installed
[Issue #3014 - @zangobot, @martinhsv]
- Fix memory leak of validateDTD's dtd object
[Issue #3008 - @martinhsv, @zimmerle]
- Fix memory leaks in ValidateSchema
Expand Down
4 changes: 2 additions & 2 deletions src/operators/validate_dtd.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@
namespace modsecurity {
namespace operators {

#ifdef WITH_LIBXML2
class XmlDtdPtrManager {
public:
/** @ingroup ModSecurity_Operator */
explicit XmlDtdPtrManager(xmlDtdPtr dtd)
: m_dtd(dtd) { }
~XmlDtdPtrManager() {
#ifdef WITH_LIBXML2
if (m_dtd != NULL) {
xmlFreeDtd(m_dtd);
m_dtd = NULL;
}
#endif
}
xmlDtdPtr get() const {return m_dtd;}
private:
xmlDtdPtr m_dtd; // The resource being managed
};
#endif

class ValidateDTD : public Operator {
public:
Expand Down

0 comments on commit 5b094c0

Please sign in to comment.