]> granicus.if.org Git - postgresql/commitdiff
Fix core dump of ispell for case of non-successfull initialization.
authorTeodor Sigaev <teodor@sigaev.ru>
Mon, 4 Dec 2006 09:26:57 +0000 (09:26 +0000)
committerTeodor Sigaev <teodor@sigaev.ru>
Mon, 4 Dec 2006 09:26:57 +0000 (09:26 +0000)
Previous versions aren't affected.

Fix synonym dictionary init: string should be malloc'ed, not palloc'ed. Bug
introduced recently while fixing lowerstr().

contrib/tsearch2/dict_syn.c
contrib/tsearch2/ispell/spell.c

index cddbd473508285a0f138fa732732b7b2bfe51785..05cb1102502222a93ca794ab1f17bc75a906906d 100644 (file)
@@ -1,4 +1,4 @@
-/* $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
@@ -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);
index 66ccca4d07c9bcd2f874c2ae14b8ceaabcbf3e5b..c14012a6e7346f8e297f175fbfbd23f9d7145ca7 100644 (file)
@@ -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);
        }