summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeodor Sigaev2004-05-31 13:55:19 +0000
committerTeodor Sigaev2004-05-31 13:55:19 +0000
commit7cb55d21ed8d9f6071eb7835b861d5231cd45e14 (patch)
treeee1affb5f4aafd40094b318bb6ee5905c8c82f94
parentd222bb4d5ec7cf057f318e88992c8c06d5494ca8 (diff)
Fix memory leak with pg_regexec
-rw-r--r--contrib/tsearch2/ispell/spell.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/contrib/tsearch2/ispell/spell.c b/contrib/tsearch2/ispell/spell.c
index caae1fc5c70..fa624738959 100644
--- a/contrib/tsearch2/ispell/spell.c
+++ b/contrib/tsearch2/ispell/spell.c
@@ -662,8 +662,11 @@ CheckAffix(const char *word, size_t len, AFFIX * Affix, char flagflags, char *ne
data = (pg_wchar *) palloc((dat_len + 1) * sizeof(pg_wchar));
data_len = pg_mb2wchar_with_len(newword, data, dat_len);
- if (!(err = pg_regexec(&(Affix->reg), data,dat_len,NULL, 1, subs, 0)))
+ if (!(err = pg_regexec(&(Affix->reg), data,dat_len,NULL, 1, subs, 0))) {
+ pfree(data);
return newword;
+ }
+ pfree(data);
return NULL;
}