From 6f09c1fd7f63d404b4d258eb5aa738c34ba3f466 Mon Sep 17 00:00:00 2001 From: Andreas Karlsson Date: Thu, 2 Apr 2026 20:04:02 +0200 Subject: [PATCH] Use simple_ptr_list_destroy() rather than reimplementing it Copying the function and adding a pfree() never made any sense. But on top of this I wonder why we only free the list and not the items contained in the list. --- src/catalog/tde_keyring.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/src/catalog/tde_keyring.c b/src/catalog/tde_keyring.c index 6ed8b5c6..a6231f1e 100644 --- a/src/catalog/tde_keyring.c +++ b/src/catalog/tde_keyring.c @@ -63,7 +63,6 @@ static char *get_file_value(const char *path, const char *field_name); #ifdef FRONTEND static SimplePtrList *scan_key_provider_file(ProviderScanType scanType, void *scanKey, Oid dbOid); -static void simple_list_free(SimplePtrList *list); #else @@ -711,28 +710,12 @@ GetKeyProviderByID(int provider_id, Oid dbOid) if (providers != NULL) { keyring = (GenericKeyring *) providers->head->ptr; - simple_list_free(providers); + simple_ptr_list_destroy(providers); + pfree(providers); } return keyring; } - -static void -simple_list_free(SimplePtrList *list) -{ - SimplePtrListCell *cell = list->head; - - while (cell != NULL) - { - SimplePtrListCell *next; - - next = cell->next; - pfree(cell); - cell = next; - } - - pfree(list); -} #endif /* FRONTEND */ /* @@ -1089,7 +1072,8 @@ GetKeyProviderByName(const char *provider_name, Oid dbOid) list_free(providers); #else keyring = (GenericKeyring *) providers->head->ptr; - simple_list_free(providers); + simple_ptr_list_destroy(providers); + pfree(providers); #endif } else