From: Victor Julien Date: Fri, 2 Nov 2012 16:46:34 +0000 (+0100) Subject: Fix GetUsed functions for Host, Flow and Defrag. X-Git-Tag: suricata-1.4beta3~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1573a366db94ca34cd79c7b718760679f0c5194;p=thirdparty%2Fsuricata.git Fix GetUsed functions for Host, Flow and Defrag. --- diff --git a/src/defrag-hash.c b/src/defrag-hash.c index f617d3f62a..f6c4523f93 100644 --- a/src/defrag-hash.c +++ b/src/defrag-hash.c @@ -642,7 +642,7 @@ static DefragTracker *DefragTrackerGetUsedDefragTracker(void) { uint32_t cnt = defrag_config.hash_size; while (cnt--) { - if (idx++ >= defrag_config.hash_size) + if (++idx >= defrag_config.hash_size) idx = 0; DefragTrackerHashRow *hb = &defragtracker_hash[idx]; diff --git a/src/flow-hash.c b/src/flow-hash.c index f64aacd10b..0747633b89 100644 --- a/src/flow-hash.c +++ b/src/flow-hash.c @@ -592,7 +592,7 @@ static Flow *FlowGetUsedFlow(void) { uint32_t cnt = flow_config.hash_size; while (cnt--) { - if (idx++ >= flow_config.hash_size) + if (++idx >= flow_config.hash_size) idx = 0; FlowBucket *fb = &flow_hash[idx]; diff --git a/src/host.c b/src/host.c index f62d7dfb64..df210d4b7a 100644 --- a/src/host.c +++ b/src/host.c @@ -563,7 +563,7 @@ static Host *HostGetUsedHost(void) { uint32_t cnt = host_config.hash_size; while (cnt--) { - if (idx++ >= host_config.hash_size) + if (++idx >= host_config.hash_size) idx = 0; HostHashRow *hb = &host_hash[idx];