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 b6959e90e30..1cda70d2c43 100644 --- a/src/backend/tsearch/dict_ispell.c +++ b/src/backend/tsearch/dict_ispell.c @@ -127,20 +127,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; |
