mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
tools: fix memory leaks in hsmtool
Detected by ASan in test_hsmtool_generatehsm: ==58698==ERROR: LeakSanitizer: detected memory leaks Direct leak of 120 byte(s) in 1 object(s) allocated from: #0 0x4e6247 in malloc #1 0x7f078452d672 in getdelim SUMMARY: AddressSanitizer: 120 byte(s) leaked in 1 allocation(s).
This commit is contained in:
parent
e457681f3a
commit
debec7d6e9
@ -448,6 +448,7 @@ static void get_words(struct words **words) {
|
||||
if (errno == ERANGE || (errno != 0 && val == 0) || endptr == selected || val < 0 || val >= ARRAY_SIZE(languages))
|
||||
errx(ERROR_USAGE, "Invalid language selection, select one from the list [0-6].");
|
||||
|
||||
free(selected);
|
||||
bip39_get_wordlist(languages[val].abbr, words);
|
||||
}
|
||||
|
||||
@ -610,6 +611,8 @@ static int check_hsm(const char *hsm_secret_path)
|
||||
errx(ERROR_KEYDERIV, "resulting hsm_secret did not match");
|
||||
|
||||
printf("OK\n");
|
||||
|
||||
free(passphrase);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user