Commit 6cd9a584 authored by Teodor Sigaev's avatar Teodor Sigaev

Fix core dump of ispell for case of non-successfull initialization.

Previous versions aren't affected.

Fix synonym dictionary init: string should be malloc'ed, not palloc'ed. Bug
introduced recently while fixing lowerstr().
parent 8dcc8e37
/* $PostgreSQL: pgsql/contrib/tsearch2/dict_syn.c,v 1.10 2006/11/20 14:03:30 teodor Exp $ */ /* $PostgreSQL: pgsql/contrib/tsearch2/dict_syn.c,v 1.11 2006/12/04 09:26:57 teodor Exp $ */
/* /*
* ISpell interface * ISpell interface
...@@ -132,8 +132,8 @@ syn_init(PG_FUNCTION_ARGS) ...@@ -132,8 +132,8 @@ syn_init(PG_FUNCTION_ARGS)
continue; continue;
*end = '\0'; *end = '\0';
d->syn[cur].in = lowerstr(starti); d->syn[cur].in = strdup(lowerstr(starti));
d->syn[cur].out = lowerstr(starto); d->syn[cur].out = strdup(lowerstr(starto));
if (!(d->syn[cur].in && d->syn[cur].out)) if (!(d->syn[cur].in && d->syn[cur].out))
{ {
fclose(fin); fclose(fin);
......
...@@ -1528,7 +1528,7 @@ NIFree(IspellDict * Conf) ...@@ -1528,7 +1528,7 @@ NIFree(IspellDict * Conf)
if (Conf->Spell) if (Conf->Spell)
{ {
for (i = 0; i < Conf->nspell; i++) for (i = 0; i < Conf->nspell; i++)
pfree(Conf->Spell[i]->word); pfree(Conf->Spell[i]);
pfree(Conf->Spell); pfree(Conf->Spell);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment