From f9734a3ed163521ce9a9fbc69f11c33dda7430d5 Mon Sep 17 00:00:00 2001 From: Parikshit Sarode Date: Fri, 20 Oct 2023 18:16:07 +0530 Subject: [PATCH] Fix crash in pgstat_init_function_usage (#1935) Crash in pgstat_init_function_usage_wrapper due to the ReleaseSysCache is being called even if proctup is Invalid. ReleaseSysCache on proctup should only be called when proctup is validated by HeapTupleIsValid. Task: BABEL-4466 Signed-off-by: Parikshit Sarode pasarode@amazon.com --- contrib/babelfishpg_tsql/src/hooks.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/contrib/babelfishpg_tsql/src/hooks.c b/contrib/babelfishpg_tsql/src/hooks.c index eb82f8699c..1a368916bf 100644 --- a/contrib/babelfishpg_tsql/src/hooks.c +++ b/contrib/babelfishpg_tsql/src/hooks.c @@ -798,12 +798,10 @@ pgstat_init_function_usage_wrapper(FunctionCallInfo fcinfo, { Form_pg_proc proc = (Form_pg_proc) GETSTRUCT(proctup); pre_wrapper_pgstat_init_function_usage(NameStr(proc->proname)); + ReleaseSysCache(proctup); } - - ReleaseSysCache(proctup); } } - } static Node *