@@ -244,7 +244,7 @@ parse_subscription_options(List *options, bool *connect, bool *enabled_given,
244244}
245245
246246/*
247- * Auxiliary function toreturn a text array out of a list of String nodes.
247+ * Auxiliary function tobuild a text array out of a list of String nodes.
248248 */
249249static Datum
250250publicationListToArray (List * publist )
@@ -264,7 +264,8 @@ publicationListToArray(List *publist)
264264ALLOCSET_DEFAULT_MAXSIZE );
265265oldcxt = MemoryContextSwitchTo (memcxt );
266266
267- datums = palloc (sizeof (text * )* list_length (publist ));
267+ datums = (Datum * )palloc (sizeof (Datum )* list_length (publist ));
268+
268269foreach (cell ,publist )
269270{
270271char * name = strVal (lfirst (cell ));
@@ -275,7 +276,7 @@ publicationListToArray(List *publist)
275276{
276277char * pname = strVal (lfirst (pcell ));
277278
278- if (name == pname )
279+ if (pcell == cell )
279280break ;
280281
281282if (strcmp (name ,pname )== 0 )
@@ -292,6 +293,7 @@ publicationListToArray(List *publist)
292293
293294arr = construct_array (datums ,list_length (publist ),
294295TEXTOID ,-1 , false,'i' );
296+
295297MemoryContextDelete (memcxt );
296298
297299return PointerGetDatum (arr );