diff options
Diffstat (limited to 'src/backend/tsearch/dict_ispell.c')
-rw-r--r-- | src/backend/tsearch/dict_ispell.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/backend/tsearch/dict_ispell.c b/src/backend/tsearch/dict_ispell.c index 31929c00acf..a7f13b2a94c 100644 --- a/src/backend/tsearch/dict_ispell.c +++ b/src/backend/tsearch/dict_ispell.c @@ -128,20 +128,19 @@ dispell_lexize(PG_FUNCTION_ARGS) if (res == NULL) PG_RETURN_POINTER(NULL); - ptr = cptr = res; - while (ptr->lexeme) + cptr = res; + for (ptr = cptr; ptr->lexeme; ptr++) { if (searchstoplist(&(d->stoplist), ptr->lexeme)) { pfree(ptr->lexeme); ptr->lexeme = NULL; - ptr++; } else { - memcpy(cptr, ptr, sizeof(TSLexeme)); + if (cptr != ptr) + memcpy(cptr, ptr, sizeof(TSLexeme)); cptr++; - ptr++; } } cptr->lexeme = NULL; |