app/test: fix crash for fbk hashes with a lot of entries
authorBruce Richardson <bruce.richardson@intel.com>
Fri, 17 Oct 2014 13:18:12 +0000 (14:18 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 20 Oct 2014 21:50:35 +0000 (23:50 +0200)
commit46bf72f97b40477ff9a55cbf367b6693c1e360a0
tree394c18ddcb5f3dfbb66a193874d5bfe37c83a46c
parentf2c4afab581cf7e9be5ff65ec2d3afe92cd4a726
app/test: fix crash for fbk hashes with a lot of entries

The four-byte-key (fbk) autotest was allocating the keys to be used for
the test on the stack. When the number of entries in the table was
increased significantly, for example, to test larger hashes by increase the
value of ENTRIES, this array of keys was greater than that
allowed on the stack, and so caused problems, i.e. crashes and core dumps.

The solution is to have the keys dynamically allocated on the heap using
malloc. Now if ENTRIES is increased and we run out of memory we get an
error message instead of a crash.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
app/test/test_hash_perf.c