Fix memory leak on VerifyCC operator

This commit is contained in:
Felipe Zimmerle 2016-06-16 12:40:05 -03:00
parent a4c7d534f2
commit 8b9041c2da
No known key found for this signature in database
GPG Key ID: E6DFB08CE8B11277
2 changed files with 11 additions and 0 deletions

View File

@ -26,6 +26,16 @@
namespace modsecurity {
namespace operators {
VerifyCC::~VerifyCC() {
if (m_pc != NULL) {
pcre_free(m_pc);
m_pc = NULL;
}
if (m_pce != NULL) {
pcre_free_study(m_pce);
m_pce = NULL;
}
}
/**
* Luhn Mod-10 Method (ISO 2894/ANSI 4.13)

View File

@ -31,6 +31,7 @@ class VerifyCC : public Operator {
: Operator(op, param, negation),
m_pc(NULL),
m_pce(NULL) { }
~VerifyCC();
int luhnVerify(const char *ccnumber, int len);
bool evaluate(Transaction *transaction, const std::string &input) override;