Adjust position of memset from 2890

This commit is contained in:
Martin Vierula 2023-04-19 08:13:48 -07:00
parent 09568351d9
commit b9eb39af83
No known key found for this signature in database
GPG Key ID: F2FC4E45883BCBA4
2 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,7 @@
v3.x.y - YYYY-MMM-DD (to be released) v3.x.y - YYYY-MMM-DD (to be released)
------------------------------------- -------------------------------------
- Adjust position of memset from 2890
[Issue #2891 - @mirkodziadzka-avi, @martinhsv]
- Add test: empty lines in ipMatchFromFile test - Add test: empty lines in ipMatchFromFile test
[Issue #2846 - @tomsommer] [Issue #2846 - @tomsommer]

View File

@ -258,11 +258,13 @@ int InsertNetmask(TreeNode *node, TreeNode *parent, TreeNode *new_node,
} }
node->count++; node->count++;
node->netmasks = reinterpret_cast<unsigned char *>(malloc(node->count * sizeof(unsigned char))); node->netmasks = reinterpret_cast<unsigned char *>(malloc(node->count * sizeof(unsigned char)));
if(node->netmasks == NULL) {
return 0;
}
memset(node->netmasks, 0, (node->count * sizeof(unsigned char))); memset(node->netmasks, 0, (node->count * sizeof(unsigned char)));
if(node->netmasks == NULL)
return 0;
if ((node->count-1) == 0) { if ((node->count-1) == 0) {
node->netmasks[0] = netmask; node->netmasks[0] = netmask;
return 1; return 1;