@@ -5051,7 +5051,7 @@ getRelationIdentity(StringInfo buffer, Oid relid, List **object)
5051
5051
}
5052
5052
5053
5053
/*
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.
5055
5055
*/
5056
5056
ArrayType *
5057
5057
strlist_to_textarray (List * list )
@@ -5063,12 +5063,14 @@ strlist_to_textarray(List *list)
5063
5063
MemoryContext memcxt ;
5064
5064
MemoryContext oldcxt ;
5065
5065
5066
+ /* Work in a temp context; easier than individually pfree'ing the Datums */
5066
5067
memcxt = AllocSetContextCreate (CurrentMemoryContext ,
5067
5068
"strlist to array" ,
5068
5069
ALLOCSET_DEFAULT_SIZES );
5069
5070
oldcxt = MemoryContextSwitchTo (memcxt );
5070
5071
5071
- datums = palloc (sizeof (text * )* list_length (list ));
5072
+ datums = (Datum * )palloc (sizeof (Datum )* list_length (list ));
5073
+
5072
5074
foreach (cell ,list )
5073
5075
{
5074
5076
char * name = lfirst (cell );
@@ -5080,6 +5082,7 @@ strlist_to_textarray(List *list)
5080
5082
5081
5083
arr = construct_array (datums ,list_length (list ),
5082
5084
TEXTOID ,-1 , false,'i' );
5085
+
5083
5086
MemoryContextDelete (memcxt );
5084
5087
5085
5088
return arr ;