diff --git a/plugins/sql.c b/plugins/sql.c index f065fc588e45..9c3cbadcc92b 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); @@ -2208,11 +2213,13 @@ 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; } 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;