Commit 0089af8e authored by Daniel Black's avatar Daniel Black Committed by Vicențiu Ciorbaru

MDEV-9433: [PATCH] cppcheck reported a number of minor coding errors

Fix a bug in testhash.c that caused an out of bounds memory access
when command line parameters specified 0 records to be inserted
in the hashtable.
Signed-off-by: default avatarVicențiu Ciorbaru <vicentiu@mariadb.org>
parent cf721d23
......@@ -169,7 +169,9 @@ static int do_test()
for (j=0 ; j < 1000 ; j++)
if (key1[j] > 1)
break;
if (key1[j] > 1)
// j will be 1000 only if we have no keys in the hash. This only happens
// when the parameter recant is set to 0 via command line argument.
if (j < 1000 && key1[j] > 1)
{
HASH_SEARCH_STATE state;
printf("- Testing identical read\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment