@@ -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 */
50565056ArrayType *
50575057strlist_to_textarray (List * list )
@@ -5063,12 +5063,14 @@ strlist_to_textarray(List *list)
50635063MemoryContext memcxt ;
50645064MemoryContext oldcxt ;
50655065
5066+ /* Work in a temp context; easier than individually pfree'ing the Datums */
50665067memcxt = AllocSetContextCreate (CurrentMemoryContext ,
50675068"strlist to array" ,
50685069ALLOCSET_DEFAULT_SIZES );
50695070oldcxt = MemoryContextSwitchTo (memcxt );
50705071
5071- datums = palloc (sizeof (text * )* list_length (list ));
5072+ datums = (Datum * )palloc (sizeof (Datum )* list_length (list ));
5073+
50725074foreach (cell ,list )
50735075{
50745076char * name = lfirst (cell );
@@ -5080,6 +5082,7 @@ strlist_to_textarray(List *list)
50805082
50815083arr = construct_array (datums ,list_length (list ),
50825084TEXTOID ,-1 , false,'i' );
5085+
50835086MemoryContextDelete (memcxt );
50845087
50855088return arr ;