Skip to content

Commit 4f30857

Browse files
morehousecdecker
authored andcommitted
lightningd: close plugin dir on return
Memory leak detected by ASan: ==880002==ERROR: LeakSanitizer: detected memory leaks Direct leak of 32816 byte(s) in 1 object(s) allocated from: #0 0x5039e7 in malloc (lightningd/lightningd+0x5039e7) #1 0x7f2e8c203884 in __alloc_dir (/lib64/libc.so.6+0xd2884)
1 parent e81bf8b commit 4f30857

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lightningd/plugin.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1703,9 +1703,11 @@ char *add_plugin_dir(struct plugins *plugins, const char *dir, bool error_ok)
17031703
} else {
17041704
p = plugin_register(plugins, fullpath, NULL, false,
17051705
NULL, NULL);
1706-
if (!p && !error_ok)
1706+
if (!p && !error_ok) {
1707+
closedir(d);
17071708
return tal_fmt(NULL, "Failed to register %s: %s",
17081709
fullpath, strerror(errno));
1710+
}
17091711
}
17101712
}
17111713
closedir(d);

0 commit comments

Comments
 (0)