From 666e1b320f8ad1ca9febb01b7cb50418ab8b2d6b Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 3 May 2018 21:50:26 +0930 Subject: [PATCH] lightningd: fix double-specified args. We need to make sure the arg is a tal object, as we'll free it next time. Signed-off-by: Rusty Russell --- cli/lightning-cli.c | 4 ++++ common/configdir.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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)