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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-05-03 21:50:26 +09:30
committed by Christian Decker
parent 6139fee31d
commit 666e1b320f
2 changed files with 5 additions and 1 deletions

View File

@@ -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;

View File

@@ -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)