mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
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)
This commit is contained in:
committed by
Christian Decker
parent
e81bf8b89f
commit
4f30857401
@@ -1703,11 +1703,13 @@ char *add_plugin_dir(struct plugins *plugins, const char *dir, bool error_ok)
|
|||||||
} else {
|
} else {
|
||||||
p = plugin_register(plugins, fullpath, NULL, false,
|
p = plugin_register(plugins, fullpath, NULL, false,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
if (!p && !error_ok)
|
if (!p && !error_ok) {
|
||||||
|
closedir(d);
|
||||||
return tal_fmt(NULL, "Failed to register %s: %s",
|
return tal_fmt(NULL, "Failed to register %s: %s",
|
||||||
fullpath, strerror(errno));
|
fullpath, strerror(errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
closedir(d);
|
closedir(d);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user