From e36578c94cfbea9a3591fceb49fb0db360f6fe4e Mon Sep 17 00:00:00 2001 From: Pavel Seleznev Date: Mon, 23 Dec 2024 16:57:13 +0300 Subject: [PATCH] fix initialization of pgspHashKey structure --- pg_store_plans.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pg_store_plans.c b/pg_store_plans.c index a8f01ca..76db178 100644 --- a/pg_store_plans.c +++ b/pg_store_plans.c @@ -548,7 +548,7 @@ _PG_init(void) EmitWarningsOnPlaceholders("pg_store_plans"); -#if PG_VERSION_NUM < 150000 +#if PG_VERSION_NUM < 150000 pgsp_shmem_request(); #endif @@ -1216,6 +1216,8 @@ pgsp_store(char *plan, queryid_t queryId, Assert(plan != NULL && queryId != PGSP_NO_QUERYID); + memset(&key, 0, sizeof(pgspHashKey)); + /* Safety check... */ if (!shared_state || !hash_table) return; @@ -1292,7 +1294,7 @@ pgsp_store(char *plan, queryid_t queryId, /* shorten_plan is terminated by NUL */ if (plan_storage == PLAN_STORAGE_SHMEM) memcpy(SHMEM_PLAN_PTR(entry), shorten_plan, plan_len + 1); - + /* If needed, perform garbage collection while exclusive lock held */ if (do_gc)