changeset 2272:4f52b7f5fe51

Bail out from the matching search if we exceed the match limits.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 17 Jun 2019 11:50:12 +0300
parents dcf9abeec930
children 6878aad714ce
files tools/fanalyze.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tools/fanalyze.c	Mon Jun 17 11:41:33 2019 +0300
+++ b/tools/fanalyze.c	Mon Jun 17 11:50:12 2019 +0300
@@ -956,8 +956,10 @@
                         if (cnt >= optMinMatchLen)
                         {
                             // Match found
-                            dmAddMatchSequence(file1->data + moffs1, cnt, file1, moffs1);
-                            dmAddMatchSequence(file2->data + moffs2, cnt, file2, moffs2);
+                            if (!dmAddMatchSequence(file1->data + moffs1, cnt, file1, moffs1) ||
+                                !dmAddMatchSequence(file2->data + moffs2, cnt, file2, moffs2))
+                                goto done;
+
                             moffs1 += cnt;
                         }
                     }
@@ -969,6 +971,8 @@
             file1->analyzed = TRUE;
         }
 
+done:
+
         for (int nmatch = 0; nmatch < ndmSequences; nmatch++)
         {
             DMMatchSeq *seq = &dmSequences[nmatch];