mirror of https://github.com/citusdata/citus.git
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
parent
00d836e5a3
commit
04aa34da68
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue