Invalidate ConnParamsHash at config reload

At configuration reload, we free all "global" (i.e. GUC-set) connection
parameters, but these may still have live references in the connection
parameters hash. By marking the entries as invalid, we can ensure they
will not be used after free.
pull/2632/head
Jason Petersen 2019-03-17 23:07:11 -06:00
parent 00d836e5a3
commit 04aa34da68
1 changed files with 13 additions and 2 deletions

View File

@ -77,16 +77,27 @@ void
ResetConnParams()
{
Index paramIdx = 0;
for (paramIdx = 0; paramIdx < ConnParams.size; paramIdx++)
{
/* FIXME: People still have references to these! */
free((void *) ConnParams.keywords[paramIdx]);
free((void *) ConnParams.values[paramIdx]);
ConnParams.keywords[paramIdx] = ConnParams.values[paramIdx] = NULL;
}
if (ConnParamsHash != NULL)
{
ConnParamsHashEntry *entry = NULL;
HASH_SEQ_STATUS status;
hash_seq_init(&status, ConnParamsHash);
while ((entry = (ConnParamsHashEntry *) hash_seq_search(&status)) != NULL)
{
entry->isValid = false;
}
}
ConnParams.size = 0;
AddConnParam("fallback_application_name", "citus");