From a7d0c08f0e5f42746e2a2ab922926dfbb0c1a2a0 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] 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;