This commit is contained in:
Kyryl Melekhin
2021-07-19 00:38:18 +00:00
parent 1e32e0d586
commit 1633ca5c3b

6
pike.c
View File

@@ -507,7 +507,7 @@ int re_comp(rcode *prog, const char *re, int anchored)
case SAVE: \
if (sub->ref > 1) { \
for (j = 0; j < subidx; j++) { \
if (nsubs[j].ref <= 0) { \
if (!nsubs[j].ref) { \
s1 = &nsubs[j]; \
goto freedsub##nn; \
} \
@@ -583,9 +583,11 @@ int re_pikevm(rcode *prog, const char *s, const char **subp, int nsubp)
npc += *(npc+1) * 2 + 2;
goto addthread;
case MATCH:
if (matched)
matched->ref = 0;
matched = nsub;
for(i++; i < clist->n; i++)
clist->t[i].sub->ref--;
clist->t[i].sub->ref = 0;
goto BreakFor;
}
nsub->ref--;