Skip to content

Commit 686e3eb

Browse files
committed
tools: fix memory leak 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).
1 parent 4f30857 commit 686e3eb

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/hsmtool.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ static void get_words(struct words **words) {
448448
if (errno == ERANGE || (errno != 0 && val == 0) || endptr == selected || val < 0 || val >= ARRAY_SIZE(languages))
449449
errx(ERROR_USAGE, "Invalid language selection, select one from the list [0-6].");
450450

451+
free(selected);
451452
bip39_get_wordlist(languages[val].abbr, words);
452453
}
453454

0 commit comments

Comments
 (0)