Fix: validateDTD compile fails if when libxml2 not installed

This commit is contained in:
Martin Vierula 2023-11-06 20:35:05 -08:00
parent cb4d7ae371
commit c11b28292d
No known key found for this signature in database
GPG Key ID: F2FC4E45883BCBA4
2 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -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: