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

Commit7376390

Browse files
committed
Fix bogus size calculation in strlist_to_textarray().
It's making an array of Datum, not an array of text *. The mistakeis harmless since those are currently the same size, but it's stillwrong.
1 parent335f3d0 commit7376390

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎src/backend/catalog/objectaddress.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5051,7 +5051,7 @@ getRelationIdentity(StringInfo buffer, Oid relid, List **object)
50515051
}
50525052

50535053
/*
5054-
* Auxiliary function toreturn a TEXT array out of a list of C-strings.
5054+
* Auxiliary function tobuild a TEXT array out of a list of C-strings.
50555055
*/
50565056
ArrayType*
50575057
strlist_to_textarray(List*list)
@@ -5063,12 +5063,14 @@ strlist_to_textarray(List *list)
50635063
MemoryContextmemcxt;
50645064
MemoryContextoldcxt;
50655065

5066+
/* Work in a temp context; easier than individually pfree'ing the Datums */
50665067
memcxt=AllocSetContextCreate(CurrentMemoryContext,
50675068
"strlist to array",
50685069
ALLOCSET_DEFAULT_SIZES);
50695070
oldcxt=MemoryContextSwitchTo(memcxt);
50705071

5071-
datums=palloc(sizeof(text*)*list_length(list));
5072+
datums= (Datum*)palloc(sizeof(Datum)*list_length(list));
5073+
50725074
foreach(cell,list)
50735075
{
50745076
char*name=lfirst(cell);
@@ -5080,6 +5082,7 @@ strlist_to_textarray(List *list)
50805082

50815083
arr=construct_array(datums,list_length(list),
50825084
TEXTOID,-1, false,'i');
5085+
50835086
MemoryContextDelete(memcxt);
50845087

50855088
returnarr;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp