Project

General

Profile

Bug #126 » 0004-Release-the-tmp-prefix-used-for-searching-on-the-rad.patch

the fix - Pablo Rincon, 04/12/2010 08:13 AM

View differences:

src/util-radix-tree.c
if (node == NULL)
return NULL;
/* hold the node found containing a netmask. We will need it when we call
* this function recursively */
netmask_node = node;
......
node = node->left;
}
if (node == NULL)
if (node == NULL) {
SCRadixReleasePrefix(prefix, tree);
return NULL;
}
}
if (node->bit != prefix->bitlen || node->prefix == NULL)
if (node->bit != prefix->bitlen || node->prefix == NULL) {
SCRadixReleasePrefix(prefix, tree);
return NULL;
}
bytes = prefix->bitlen / 8;
if (memcmp(node->prefix->stream, prefix->stream, bytes) == 0) {
......
if (prefix->bitlen % 8 == 0 ||
(node->prefix->stream[bytes] & mask) == (prefix->stream[bytes] & mask)) {
if (SCRadixPrefixContainNetmaskAndSetUserData(node->prefix, key_bitlen, 1))
if (SCRadixPrefixContainNetmaskAndSetUserData(node->prefix, key_bitlen, 1)) {
SCRadixReleasePrefix(prefix, tree);
return node;
}
}
}
/* if you are not an ip key, get out of here */
if (exact_match)
if (exact_match) {
SCRadixReleasePrefix(prefix, tree);
return NULL;
}
return SCRadixFindKeyIPNetblock(prefix, node);
SCRadixNode *ret = SCRadixFindKeyIPNetblock(prefix, node);
SCRadixReleasePrefix(prefix, tree);
return ret;
}
/**
(1-1/3)