#38 Bug in removing duplicated from suggestions

closed-fixed
None
5
2010-08-10
2010-06-29
Anonymous
No

Within Hunspell::suggest the code commented "remove duplications" causes freed memory to be accessed if any duplicates are actually freed. Replace the code block with this below:

// remove duplications
int l = 0;
for (int j = 0; j < ns; j++)
{
(*slst)[l] = (*slst)[j];
for (int k = 0; k < l; k++)
{
if (strcmp((*slst)[k], (*slst)[j]) == 0)
{
free((*slst)[j]);
l--;
break;
}
}
l++;
}
ns = l;

Discussion

  • Thanks, fix checked in for 1.2.13

     
    • assigned_to: nobody --> caolan
    • status: open --> closed-fixed