Code cleanup: Initialize variables and others good practice

- initialize invalid_countin UrlDecode :: evaluate
- Free resources before the process die (good practice)
This commit is contained in:
Robert Paprocki 2018-04-30 15:25:02 -07:00 committed by Felipe Zimmerle
parent a278bb673a
commit e4c822e663
No known key found for this signature in database
GPG Key ID: E6DFB08CE8B11277
3 changed files with 10 additions and 6 deletions

View File

@ -5,14 +5,12 @@ v3.0.3 - YYYY-MMM-DD (to be released)
[Issue #1771 - @Artistan]
- Checks if response body inspection is enabled before process it
[Issue #1643 - @zoltan-fedor, @dennus, @defanator, @zimmerle]
- processContentOffset Cleanup
[Issue #1757 - @p0pr0ck5]
- Code Cleanup.
[Issue #1757, #1755, #1756, #1761 - @p0pr0ck5]
- Fix setvar parsing of quoted data
[Issue #1733, #1759 - @JaiHarpalani, @victorhora, @defanator]
- Fix LDFLAGS for unit tests.
[Issue #1758 - @smlx]
- Code cosmetics: Clean up MD5 hexdigest
[Issue #1761 - @p0pr0ck5]
- Adds time stamp back to the audit logs
[Issue #1762 - @Pjack, @zimmerle]
- Disables skip counter if debug log is disabled

View File

@ -40,7 +40,7 @@ UrlDecode::UrlDecode(std::string action)
std::string UrlDecode::evaluate(std::string value,
Transaction *transaction) {
unsigned char *val = NULL;
int invalid_count;
int invalid_count = 0;
int changed;
val = (unsigned char *) malloc(sizeof(char) * value.size() + 1);

View File

@ -461,8 +461,11 @@ TreeNode *CPTAddElement(unsigned char *ipdata, unsigned int ip_bitmask, CPTTree
} else {
i_node = CPTCreateNode();
if(i_node == NULL)
if (i_node == NULL) {
free(new_node->prefix);
free(new_node);
return NULL;
}
//i_node->prefix = NULL;
i_node->bit = test_bit;
@ -480,6 +483,9 @@ TreeNode *CPTAddElement(unsigned char *ipdata, unsigned int ip_bitmask, CPTTree
i_node->netmasks = reinterpret_cast<unsigned char *>(malloc((node->count - i) * sizeof(unsigned char)));
if(i_node->netmasks == NULL) {
free(new_node->prefix);
free(new_node);
free(i_node);
return NULL;
}