Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7cb55d2

Browse files
committed
Fix memory leak with pg_regexec
1 parent d222bb4 commit 7cb55d2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

contrib/tsearch2/ispell/spell.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,8 +662,11 @@ CheckAffix(const char *word, size_t len, AFFIX * Affix, char flagflags, char *ne
662662
data = (pg_wchar *) palloc((dat_len + 1) * sizeof(pg_wchar));
663663
data_len = pg_mb2wchar_with_len(newword, data, dat_len);
664664

665-
if (!(err = pg_regexec(&(Affix->reg), data,dat_len,NULL, 1, subs, 0)))
665+
if (!(err = pg_regexec(&(Affix->reg), data,dat_len,NULL, 1, subs, 0))) {
666+
pfree(data);
666667
return newword;
668+
}
669+
pfree(data);
667670

668671
return NULL;
669672
}

0 commit comments

Comments
 (0)