diff --git a/cli/lightning-cli.c b/cli/lightning-cli.c index b2b9e9f99..c3ba63af5 100644 --- a/cli/lightning-cli.c +++ b/cli/lightning-cli.c @@ -335,6 +335,8 @@ int main(int argc, char *argv[]) printf("%.*s\n", json_tok_len(result), json_tok_contents(resp, result)); + tal_free(lightning_dir); + tal_free(rpc_filename); tal_free(ctx); opt_free_table(); return 0; @@ -342,6 +344,8 @@ int main(int argc, char *argv[]) printf("%.*s\n", json_tok_len(error), json_tok_contents(resp, error)); + tal_free(lightning_dir); + tal_free(rpc_filename); tal_free(ctx); opt_free_table(); return 1; diff --git a/common/configdir.c b/common/configdir.c index 504fdfa41..b8584d8a3 100644 --- a/common/configdir.c +++ b/common/configdir.c @@ -8,7 +8,7 @@ char *opt_set_talstr(const char *arg, char **p) { tal_free(*p); - return opt_set_charp(arg, p); + return opt_set_charp(tal_strdup(NULL, arg), p); } static char *default_configdir(const tal_t *ctx)