postgresql/src/backend/utils
Tom Lane f0c2a5bba6 Avoid leaking memory in RestoreGUCState(), and improve comments.
RestoreGUCState applied InitializeOneGUCOption to already-live
GUC entries, causing any malloc'd subsidiary data to be forgotten.
We do want the effect of resetting the GUC to its compiled-in
default, and InitializeOneGUCOption seems like the best way to do
that, so add code to free any existing subsidiary data beforehand.

The interaction between can_skip_gucvar, SerializeGUCState, and
RestoreGUCState is way more subtle than their opaque comments
would suggest to an unwary reader.  Rewrite and enlarge the
comments to try to make it clearer what's happening.

Remove a long-obsolete assertion in read_nondefault_variables: the
behavior of set_config_option hasn't depended on IsInitProcessingMode
since f5d9698a8 installed a better way of controlling it.

Although this is fixing a clear memory leak, the leak is quite unlikely
to involve any large amount of data, and it can only happen once in the
lifetime of a worker process.  So it seems unnecessary to take any
risk of back-patching.

Discussion: https://postgr.es/m/4105247.1616174862@sss.pgh.pa.us
2021-03-19 23:03:17 -04:00
..
adt Allow configurable LZ4 TOAST compression. 2021-03-19 15:10:38 -04:00
cache Don't run RelationInitTableAccessMethod in a long-lived context. 2021-03-18 22:22:47 -04:00
error Remove server and libpq support for old FE/BE protocol version 2. 2021-03-04 10:45:55 +02:00
fmgr Fix broken ruleutils support for function TRANSFORM clauses. 2021-01-25 13:03:43 -05:00
hash Update copyright for 2021 2021-01-02 13:06:25 -05:00
init Don't consider newly inserted tuples in nbtree VACUUM. 2021-03-10 16:27:01 -08:00
mb Add direct conversion routines between EUC_TW and Big5. 2021-01-28 14:53:03 +02:00
misc Avoid leaking memory in RestoreGUCState(), and improve comments. 2021-03-19 23:03:17 -04:00
mmgr Improve performance of repeated CALLs within plpgsql procedures. 2021-01-25 22:28:29 -05:00
resowner Improve performance of repeated CALLs within plpgsql procedures. 2021-01-25 22:28:29 -05:00
sort Use sort_template.h for qsort_tuple() and qsort_ssup(). 2021-03-03 17:02:32 +13:00
time Revive "snapshot too old" with wal_level=minimal and SET TABLESPACE. 2021-01-30 00:12:18 -08:00
.gitignore Rearrange makefile rules for running Gen_fmgrtab.pl. 2018-05-03 17:54:18 -04:00
errcodes.txt Rethink SQLSTATE code for ERRCODE_IDLE_SESSION_TIMEOUT. 2021-01-11 14:53:42 -05:00
Gen_dummy_probes.pl Update copyright for 2021 2021-01-02 13:06:25 -05:00
Gen_dummy_probes.sed Update copyright for 2021 2021-01-02 13:06:25 -05:00
Gen_fmgrtab.pl Update copyright for 2021 2021-01-02 13:06:25 -05:00
generate-errcodes.pl Update copyright for 2021 2021-01-02 13:06:25 -05:00
Makefile Update copyright for 2021 2021-01-02 13:06:25 -05:00
probes.d Update copyright for 2021 2021-01-02 13:06:25 -05:00