From: Teodor Sigaev Date: Mon, 4 Dec 2006 09:27:45 +0000 (+0000) Subject: Fix core dump of ispell for case of non-successfull initialization. X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=2cb42180b2fb8d9d10506c99bd4c338542e30db7;p=users%2Fbernd%2Fpostgres.git 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(). --- diff --git a/contrib/tsearch2/dict_syn.c b/contrib/tsearch2/dict_syn.c index 770fb184ca..41166be815 100644 --- a/contrib/tsearch2/dict_syn.c +++ b/contrib/tsearch2/dict_syn.c @@ -132,8 +132,8 @@ syn_init(PG_FUNCTION_ARGS) continue; *end = '\0'; - d->syn[cur].in = lowerstr(starti); - d->syn[cur].out = lowerstr(starto); + d->syn[cur].in = strdup(lowerstr(starti)); + d->syn[cur].out = strdup(lowerstr(starto)); if (!(d->syn[cur].in && d->syn[cur].out)) { fclose(fin); diff --git a/contrib/tsearch2/ispell/spell.c b/contrib/tsearch2/ispell/spell.c index 66ccca4d07..c14012a6e7 100644 --- a/contrib/tsearch2/ispell/spell.c +++ b/contrib/tsearch2/ispell/spell.c @@ -1528,7 +1528,7 @@ NIFree(IspellDict * Conf) if (Conf->Spell) { for (i = 0; i < Conf->nspell; i++) - pfree(Conf->Spell[i]->word); + pfree(Conf->Spell[i]); pfree(Conf->Spell); }