diff --git a/plugins/sql.c b/plugins/sql.c index 7f8631b000e5..25e2bee3bc71 100644 --- a/plugins/sql.c +++ b/plugins/sql.c @@ -150,6 +150,11 @@ struct sql { u64 next_rowid; }; +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); @@ -1986,6 +1991,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;