aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/scripts/reindexdb.c6
-rw-r--r--src/fe_utils/simple_list.c38
-rw-r--r--src/include/fe_utils/simple_list.h2
3 files changed, 46 insertions, 0 deletions
diff --git a/src/bin/scripts/reindexdb.c b/src/bin/scripts/reindexdb.c
index b2c0400cb9c..14a4f4a91c7 100644
--- a/src/bin/scripts/reindexdb.c
+++ b/src/bin/scripts/reindexdb.c
@@ -473,6 +473,12 @@ reindex_one_database(const char *dbname, ReindexType type,
failed = true;
finish:
+ if (process_list != user_list)
+ {
+ simple_string_list_destroy(process_list);
+ pg_free(process_list);
+ }
+
ParallelSlotsTerminate(slots, concurrentCons);
pfree(slots);
diff --git a/src/fe_utils/simple_list.c b/src/fe_utils/simple_list.c
index 8d605140a74..cfdb7dc87af 100644
--- a/src/fe_utils/simple_list.c
+++ b/src/fe_utils/simple_list.c
@@ -100,6 +100,44 @@ simple_string_list_member(SimpleStringList *list, const char *val)
}
/*
+ * Destroy an OID list
+ */
+void
+simple_oid_list_destroy(SimpleOidList *list)
+{
+ SimpleOidListCell *cell;
+
+ cell = list->head;
+ while (cell != NULL)
+ {
+ SimpleOidListCell *next;
+
+ next = cell->next;
+ pg_free(cell);
+ cell = next;
+ }
+}
+
+/*
+ * Destroy a string list
+ */
+void
+simple_string_list_destroy(SimpleStringList *list)
+{
+ SimpleStringListCell *cell;
+
+ cell = list->head;
+ while (cell != NULL)
+ {
+ SimpleStringListCell *next;
+
+ next = cell->next;
+ pg_free(cell);
+ cell = next;
+ }
+}
+
+/*
* Find first not-touched list entry, if there is one.
*/
const char *
diff --git a/src/include/fe_utils/simple_list.h b/src/include/fe_utils/simple_list.h
index 8a95cbb3a85..75738becf42 100644
--- a/src/include/fe_utils/simple_list.h
+++ b/src/include/fe_utils/simple_list.h
@@ -46,9 +46,11 @@ typedef struct SimpleStringList
extern void simple_oid_list_append(SimpleOidList *list, Oid val);
extern bool simple_oid_list_member(SimpleOidList *list, Oid val);
+extern void simple_oid_list_destroy(SimpleOidList *list);
extern void simple_string_list_append(SimpleStringList *list, const char *val);
extern bool simple_string_list_member(SimpleStringList *list, const char *val);
+extern void simple_string_list_destroy(SimpleStringList *list);
extern const char *simple_string_list_not_touched(SimpleStringList *list);