diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2017-09-23 15:16:48 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2017-09-23 15:16:48 -0400 |
commit | 24541ffd788d56009126fff52b2341ada6c84245 (patch) | |
tree | b34d80319a7ec3a22e3a01dce3b40fafb3dc04be /src | |
parent | 737639017c87d5a0a466e8676f1eadc61d775c78 (diff) | |
download | postgresql-24541ffd788d56009126fff52b2341ada6c84245.tar.gz postgresql-24541ffd788d56009126fff52b2341ada6c84245.zip |
... and the very same bug in publicationListToArray().
Sigh.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/commands/subscriptioncmds.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c index 372fa1b6344..086a6ef85ea 100644 --- a/src/backend/commands/subscriptioncmds.c +++ b/src/backend/commands/subscriptioncmds.c @@ -244,7 +244,7 @@ parse_subscription_options(List *options, bool *connect, bool *enabled_given, } /* - * Auxiliary function to return a text array out of a list of String nodes. + * Auxiliary function to build a text array out of a list of String nodes. */ static Datum publicationListToArray(List *publist) @@ -264,7 +264,8 @@ publicationListToArray(List *publist) ALLOCSET_DEFAULT_MAXSIZE); oldcxt = MemoryContextSwitchTo(memcxt); - datums = palloc(sizeof(text *) * list_length(publist)); + datums = (Datum *) palloc(sizeof(Datum) * list_length(publist)); + foreach(cell, publist) { char *name = strVal(lfirst(cell)); @@ -275,7 +276,7 @@ publicationListToArray(List *publist) { char *pname = strVal(lfirst(pcell)); - if (name == pname) + if (pcell == cell) break; if (strcmp(name, pname) == 0) @@ -292,6 +293,7 @@ publicationListToArray(List *publist) arr = construct_array(datums, list_length(publist), TEXTOID, -1, false, 'i'); + MemoryContextDelete(memcxt); return PointerGetDatum(arr); |