Cosmetics: Reduces the static analysis warnings

This commit is contained in:
Felipe Zimmerle 2016-12-28 17:46:47 -03:00
parent 9c7416da97
commit 88fb456a16
No known key found for this signature in database
GPG Key ID: E6DFB08CE8B11277
12 changed files with 37 additions and 41 deletions

View File

@ -49,7 +49,6 @@ class Serial : public Writer {
bool write(Transaction *transaction, int parts,
std::string *error) override;
private:
void generateBoundary(std::string *boundary);
};

View File

@ -63,7 +63,6 @@ void Pm::cleanup(acmp_node_t *n) {
}
free(n);
n = NULL;
}
@ -76,7 +75,6 @@ void Pm::postOrderTraversal(acmp_btree_node_t *node) {
postOrderTraversal(node->left);
free(node);
node = NULL;
}

View File

@ -62,8 +62,8 @@ class Rbl : public Operator {
/** @ingroup ModSecurity_Operator */
Rbl(std::string op, std::string param, bool negation)
: Operator(op, param, negation),
m_demandsPassword(false),
m_service(param) {
m_service(param),
m_demandsPassword(false) {
m_provider = RblProvider::UnknownProvider;
if (m_service == "httpbl.org") {
m_demandsPassword = true;

View File

@ -35,9 +35,9 @@ class ValidateSchema : public Operator {
/** @ingroup ModSecurity_Operator */
ValidateSchema(std::string o, std::string p, bool i)
: Operator(o, p, i),
m_schema(NULL),
m_parserCtx(NULL),
m_validCtx(NULL),
m_parserCtx(NULL) { }
m_schema(NULL) { }
~ValidateSchema() {
/*
if (m_schema != NULL) {

View File

@ -28,7 +28,8 @@ namespace Parser {
Driver::Driver()
: RulesProperties(),
trace_scanning(false),
trace_parsing(false) {
trace_parsing(false),
lastRule(NULL) {
m_auditLog = new audit_log::AuditLog();
m_auditLog->refCountIncrease();
}
@ -116,7 +117,6 @@ int Driver::addSecRule(Rule *rule) {
int Driver::parse(const std::string &f, const std::string &ref) {
std::string error;
lastRule = NULL;
loc.push_back(new yy::location());
if (ref.empty()) {

View File

@ -59,8 +59,6 @@ class Driver : public RulesProperties {
int addSecAction(Rule *rule);
int addSecMarker(std::string marker);
int result;
bool scan_begin();
void scan_end();
bool trace_scanning;

View File

@ -36,33 +36,35 @@ namespace RequestBodyProcessor {
Multipart::Multipart(std:: string header, Transaction *transaction)
: m_boundary_count(0),
: m_reqbody_no_files_length(0),
m_nfiles(0),
m_boundary_count(0),
m_buf{0},
m_buf_contains_line(0),
m_bufptr(NULL),
m_bufleft(0),
m_buf_offset(0),
m_bufptr(NULL),
m_flag_boundary_quoted(0),
m_flag_boundary_whitespace(0),
m_flag_crlf_line(0),
m_flag_data_after(0),
m_flag_data_before(0),
m_flag_error(0),
m_flag_file_limit_exceeded(0),
m_flag_header_folding(0),
m_flag_invalid_header_folding(0),
m_flag_invalid_part(0),
m_flag_invalid_quoting(0),
m_flag_lf_line(0),
m_flag_missing_semicolon(0),
m_flag_unmatched_boundary(0),
m_header(header),
m_is_complete(0),
m_mpp(NULL),
m_mpp_state(0),
m_nfiles(0),
m_reserve{0},
m_seen_data(0),
m_transaction(transaction),
m_reqbody_no_files_length(0)
{ }
m_is_complete(0),
m_flag_error(0),
m_flag_data_before(0),
m_flag_data_after(0),
m_flag_header_folding(0),
m_flag_boundary_quoted(0),
m_flag_lf_line(0),
m_flag_crlf_line(0),
m_flag_unmatched_boundary(0),
m_flag_boundary_whitespace(0),
m_flag_missing_semicolon(0),
m_flag_invalid_quoting(0),
m_flag_invalid_part(0),
m_flag_invalid_header_folding(0),
m_flag_file_limit_exceeded(0),
m_header(header),
m_transaction(transaction) { }
Multipart::~Multipart() {
@ -398,7 +400,7 @@ int Multipart::parse_content_disposition(const char *c_d_value) {
}
int Multipart::tmp_file_name(std::string *filename) {
int Multipart::tmp_file_name(std::string *filename) const {
std::string path;
struct tm timeinfo;
char tstr[300];
@ -1197,7 +1199,7 @@ bool Multipart::init(std::string *error) {
}
/* Case-insensitive test for the string "boundary" in the boundary. */
if (count_boundary_params(m_boundary.c_str()) != 0) {
if (count_boundary_params(m_boundary) != 0) {
m_flag_error = 1;
debug(4, "Multipart: Invalid boundary in C-T (content).");
error->assign("Multipart: Invalid boundary in C-T (content).");

View File

@ -113,7 +113,7 @@ class Multipart {
int process_part_header(std::string *error);
int process_part_data(std::string *error);
int tmp_file_name(std::string *filename);
int tmp_file_name(std::string *filename) const;
void validate_quotes(const char *data);

View File

@ -55,7 +55,6 @@ void IpTree::postOrderTraversal(TreeNode *node) {
node->prefix = NULL;
}
free(node);
node = NULL;
}

View File

@ -1,3 +1,5 @@
unusedFunction:test/regression/regression_test.cc
unusedFunction:src/utils/string.cc
unusedFunction:src/transaction.cc
unusedFunction:src/utils/mbedtls/sha1.c
unusedFunction:src/utils/mbedtls/md5.c

View File

@ -23,10 +23,6 @@
namespace modsecurity_test {
CustomDebugLog *CustomDebugLog::new_instance() {
return new CustomDebugLog();
}
CustomDebugLog::~CustomDebugLog() { }
void CustomDebugLog::write(int level, const std::string& message) {

View File

@ -380,7 +380,9 @@ after_debug_log:
int main(int argc, char **argv) {
ModSecurityTest<RegressionTest> test;
#ifndef NO_LOGS
int test_number = 0;
#endif
#ifdef WITH_GEOIP
resources.push_back("geoip");