Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9088542

Browse files
committed
Avoid core dump on empty thesaurus dictionary.
Per report from Robert Gravsjö.
1 parentbb1e8be commit9088542

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎src/backend/tsearch/dict_thesaurus.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/tsearch/dict_thesaurus.c,v 1.14 2009/07/16 06:33:44 petere Exp $
10+
* $PostgreSQL: pgsql/src/backend/tsearch/dict_thesaurus.c,v 1.15 2009/11/30 16:38:31 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -57,8 +57,8 @@ typedef struct
5757

5858
/* Array to search lexeme by exact match */
5959
TheLexeme*wrds;
60-
intnwrds;
61-
intntwrds;
60+
intnwrds;/* current number of words */
61+
intntwrds;/* allocated array length */
6262

6363
/*
6464
* Storage of substituted result, n-th element is for n-th expression
@@ -298,7 +298,6 @@ thesaurusRead(char *filename, DictThesaurus *d)
298298
staticTheLexeme*
299299
addCompiledLexeme(TheLexeme*newwrds,int*nnw,int*tnm,TSLexeme*lexeme,LexemeInfo*src,uint16tnvariant)
300300
{
301-
302301
if (*nnw >=*tnm)
303302
{
304303
*tnm *=2;
@@ -453,7 +452,8 @@ compileTheLexeme(DictThesaurus *d)
453452
pfree(d->wrds[i].entries);
454453
}
455454

456-
pfree(d->wrds);
455+
if (d->wrds)
456+
pfree(d->wrds);
457457
d->wrds=newwrds;
458458
d->nwrds=nnw;
459459
d->ntwrds=tnm;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp