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

Commitb48ecf8

Browse files
committed
In bttext_abbrev_convert, move pfree to the right place.
Without this, we might access memory that's already been freed, orleak memory if in the C locale.Peter Geoghegan
1 parent47fe4d2 commitb48ecf8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎src/backend/utils/adt/varlena.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2034,13 +2034,9 @@ bttext_abbrev_convert(Datum original, SortSupport ssup)
20342034
}
20352035

20362036
/* Just like strcoll(), strxfrm() expects a NUL-terminated string */
2037-
memcpy(tss->buf1,VARDATA_ANY(authoritative),len);
2037+
memcpy(tss->buf1,authoritative_data,len);
20382038
tss->buf1[len]='\0';
20392039

2040-
/* Don't leak memory here */
2041-
if (PointerGetDatum(authoritative)!=original)
2042-
pfree(authoritative);
2043-
20442040
for (;;)
20452041
{
20462042
#ifdefHAVE_LOCALE_T
@@ -2108,6 +2104,10 @@ bttext_abbrev_convert(Datum original, SortSupport ssup)
21082104

21092105
addHyperLogLog(&tss->abbr_card,hash);
21102106

2107+
/* Don't leak memory here */
2108+
if (PointerGetDatum(authoritative)!=original)
2109+
pfree(authoritative);
2110+
21112111
returnres;
21122112
}
21132113

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp