Browse Source

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>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
666e1b320f
  1. 4
      cli/lightning-cli.c
  2. 2
      common/configdir.c

4
cli/lightning-cli.c

@ -335,6 +335,8 @@ int main(int argc, char *argv[])
printf("%.*s\n", printf("%.*s\n",
json_tok_len(result), json_tok_len(result),
json_tok_contents(resp, result)); json_tok_contents(resp, result));
tal_free(lightning_dir);
tal_free(rpc_filename);
tal_free(ctx); tal_free(ctx);
opt_free_table(); opt_free_table();
return 0; return 0;
@ -342,6 +344,8 @@ int main(int argc, char *argv[])
printf("%.*s\n", printf("%.*s\n",
json_tok_len(error), json_tok_contents(resp, error)); json_tok_len(error), json_tok_contents(resp, error));
tal_free(lightning_dir);
tal_free(rpc_filename);
tal_free(ctx); tal_free(ctx);
opt_free_table(); opt_free_table();
return 1; return 1;

2
common/configdir.c

@ -8,7 +8,7 @@
char *opt_set_talstr(const char *arg, char **p) char *opt_set_talstr(const char *arg, char **p)
{ {
tal_free(*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) static char *default_configdir(const tal_t *ctx)

Loading…
Cancel
Save