Browse Source

[Minor] Fix case when all words are exceptions

tags/1.8.3
Vsevolod Stakhov 5 years ago
parent
commit
7fde20c6c5
1 changed files with 22 additions and 0 deletions
  1. 22
    0
      src/libutil/shingles.c

+ 22
- 0
src/libutil/shingles.c View File

@@ -176,6 +176,17 @@ rspamd_shingles_from_text (GArray *input,
}
}

if (word == NULL) {
/* Nothing but exceptions */
for (i = 0; i < RSPAMD_SHINGLE_SIZE; i ++) {
g_free (hashes[i]);
}

g_free (hashes);

return NULL;
}

row = rspamd_fstring_append (row, word->stemmed.begin,
word->stemmed.len);
}
@@ -235,6 +246,17 @@ rspamd_shingles_from_text (GArray *input,
}
}

if (word == NULL) {
/* Nothing but exceptions */
for (i = 0; i < RSPAMD_SHINGLE_SIZE; i ++) {
g_free (hashes[i]);
}

g_free (hashes);

return NULL;
}

/* Insert the last element to the pipe */
memcpy (&seed, keys[j], sizeof (seed));
window[j * SHINGLES_WINDOW + SHINGLES_WINDOW - 1] =

Loading…
Cancel
Save