commit 209cdce51c13ffded4139be97c81734e67b743e0
parent 1c22847cf2ab9c17d75e6768ef07d74c4a776bc7
Author: Denis Kenzior <denkenz@gmail.com>
Date: Mon, 1 Jul 2019 14:53:56 -0500
hotspot: Fix crash
#0 0x7f5e25e71930 in /lib64/libc.so.6
#1 0x446faa in hs20_config_free() at src/hotspot.c:63
#2 0x469542 in l_queue_clear() at ell/queue.c:109
#3 0x4694e7 in l_queue_destroy() at ell/queue.c:83
#4 0x4475c1 in hotspot_exit() at src/hotspot.c:273
#5 0x403170 in iwd_modules_exit() at src/main.c:195
#6 0x404085 in main() at src/main.c:531
#7 0x7f5e25e5cbde in /lib64/libc.so.6
Diffstat:
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/src/hotspot.c b/src/hotspot.c
@@ -239,20 +239,24 @@ static int hotspot_init(void)
while ((dirent = readdir(dir))) {
struct hs20_config *config;
- struct l_settings *s = l_settings_new();
- char *filename = l_strdup_printf("%s/%s", hs20_dir,
- dirent->d_name);
+ struct l_settings *s;
+ char *filename;
- if (!l_settings_load_from_file(s, filename)) {
- l_free(filename);
- l_settings_free(s);
+ if (dirent->d_type != DT_REG && dirent->d_type != DT_LNK)
continue;
- }
+
+ filename = l_strdup_printf("%s/%s", hs20_dir, dirent->d_name);
+ s = l_settings_new();
+
+ if (!l_settings_load_from_file(s, filename))
+ goto next;
config = hs20_config_new(s, filename);
- l_queue_push_head(hs20_settings, config);
+ if (config)
+ l_queue_push_head(hs20_settings, config);
+next:
l_free(filename);
l_settings_free(s);
}