From 8be6ded9a9eca1728274b8b2fed7cc48016c1120 Mon Sep 17 00:00:00 2001 From: Andezion <245122@edu.p.lodz.pl> Date: Thu, 8 Jan 2026 00:18:19 +0100 Subject: [PATCH 1/2] fix: add destructor to free strmap memory in sql plugin --- plugins/sql.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/sql.c b/plugins/sql.c index f065fc588e45..03c4bfea3a0a 100644 --- a/plugins/sql.c +++ b/plugins/sql.c @@ -168,6 +168,11 @@ struct sql { struct command *waitcmd; }; +static void destroy_sql(struct sql *sql) +{ + strmap_clear(&sql->tablemap); +} + static struct sql *sql_of(struct plugin *plugin) { return plugin_get_data(plugin, struct sql); @@ -2213,6 +2218,7 @@ int main(int argc, char *argv[]) } sql = tal(NULL, struct sql); + tal_add_destructor(sql, destroy_sql); sql->dbfilename = NULL; sql->gosstore_fd = -1; sql->gosstore_nodes_off = sql->gosstore_channels_off = 0; From f4b26946b783c330b590e2e2aafabee8cdf7ec35 Mon Sep 17 00:00:00 2001 From: Andezion <245122@edu.p.lodz.pl> Date: Wed, 19 Aug 2026 14:20:56 +0200 Subject: [PATCH 2/2] sql: free strmap internal nodes on plugin shutdown Changelog-None --- plugins/sql.c | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/sql.c b/plugins/sql.c index 03c4bfea3a0a..9c3cbadcc92b 100644 --- a/plugins/sql.c +++ b/plugins/sql.c @@ -2213,6 +2213,7 @@ int main(int argc, char *argv[]) printf("The following tables are currently supported:\n"); strmap_iterate(&tablemap, print_one_table, NULL); + strmap_clear(&tablemap); common_shutdown(); return 0; }