summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/dict_int/dict_int.c2
-rw-r--r--contrib/dict_xsyn/dict_xsyn.c8
2 files changed, 6 insertions, 4 deletions
diff --git a/contrib/dict_int/dict_int.c b/contrib/dict_int/dict_int.c
index 163a5029a0b..d0941c66ad9 100644
--- a/contrib/dict_int/dict_int.c
+++ b/contrib/dict_int/dict_int.c
@@ -73,7 +73,7 @@ dintdict_lexize(PG_FUNCTION_ARGS)
DictInt *d = (DictInt *) PG_GETARG_POINTER(0);
char *in = (char *) PG_GETARG_POINTER(1);
char *txt = pnstrdup(in, PG_GETARG_INT32(2));
- TSLexeme *res = palloc(sizeof(TSLexeme) * 2);
+ TSLexeme *res = palloc0(sizeof(TSLexeme) * 2);
res[1].lexeme = NULL;
if (PG_GETARG_INT32(2) > d->maxlen)
diff --git a/contrib/dict_xsyn/dict_xsyn.c b/contrib/dict_xsyn/dict_xsyn.c
index 68a631c17a7..892983c48b1 100644
--- a/contrib/dict_xsyn/dict_xsyn.c
+++ b/contrib/dict_xsyn/dict_xsyn.c
@@ -200,7 +200,7 @@ dxsyn_lexize(PG_FUNCTION_ARGS)
int nsyns = 0;
bool is_first = true;
- res = palloc(0);
+ res = palloc(sizeof(TSLexeme));
while (pos < value + value_length)
{
@@ -212,13 +212,13 @@ dxsyn_lexize(PG_FUNCTION_ARGS)
*end = '\0';
res = repalloc(res, sizeof(TSLexeme) * (nsyns + 2));
- res[nsyns].lexeme = NULL;
/* first word is added to result only if KEEPORIG flag is set */
if (d->keeporig || !is_first)
{
res[nsyns].lexeme = pstrdup(syn);
- res[nsyns + 1].lexeme = NULL;
+ res[nsyns].nvariant = 0;
+ res[nsyns].flags = 0;
nsyns++;
}
@@ -228,6 +228,8 @@ dxsyn_lexize(PG_FUNCTION_ARGS)
pos = end + 1;
}
+ res[nsyns].lexeme = NULL;
+
pfree(value);
}