We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5729ae0 commit 66c338eCopy full SHA for 66c338e
src/utils/acmp.cc
@@ -387,15 +387,15 @@ if (parser->is_active != 0) return -1;
387
child->pattern = (char *)"";
388
child->letter = letter;
389
child->depth = i;
390
- child->text = (char *)calloc(1, length + 2);
+ child->text = (char *)calloc(1, i + 2);
391
/* ENH: Check alloc succeded */
392
for (j = 0; j <= i; j++) child->text[j] = pattern[j];
393
}
394
if (i == length - 1) {
395
if (child->is_last == 0) {
396
parser->dict_count++;
397
child->is_last = 1;
398
- child->pattern = (char *)calloc(1, length + 2);
+ child->pattern = (char *)calloc(1, length + 1);
399
400
memcpy(child->pattern, pattern, length);
401
child->pattern[length] = '\0';
0 commit comments