diff --git a/dunst.c b/dunst.c index 49f06b4..e90b1b2 100644 --- a/dunst.c +++ b/dunst.c @@ -341,6 +341,9 @@ void update_lists() } to_move = most_important(notification_queue); + if (!to_move) { + return; + } n = (notification *) to_move->data; n->start = now; @@ -1641,10 +1644,10 @@ void parse_dunstrc(char *cmdline_config_path) } fclose(config_file); + free_ini(); xdgWipeHandle(&xdg); } -#endif /* STATIC_CONFIG */ char *parse_cmdline_for_config_file(int argc, char *argv[]) { @@ -1659,6 +1662,7 @@ char *parse_cmdline_for_config_file(int argc, char *argv[]) } return NULL; } +#endif /* STATIC_CONFIG */ int main(int argc, char *argv[]) { diff --git a/options.c b/options.c index 20c13cc..07fb702 100644 --- a/options.c +++ b/options.c @@ -42,6 +42,18 @@ section_t *new_section(char *name) return §ions[section_count -1]; } +void free_ini(void) +{ + for(int i = 0; i < section_count; i++) { + for (int j = 0; j < sections[i].entry_count; j++) { + free(sections[i].entries[j].key); + free(sections[i].entries[j].value); + } + free(sections[i].entries); + } + free(sections); +} + section_t *get_section(char *name) { for (int i = 0; i < section_count; i++) { diff --git a/options.h b/options.h index b4beafd..2d2d968 100644 --- a/options.h +++ b/options.h @@ -9,6 +9,7 @@ char *ini_get_string(char *section, char *key, const char *def); int ini_get_int(char *section, char *key, int def); double ini_get_double(char *section, char *key, int def); int ini_get_bool(char *section, char *key, int def); +void free_ini(void); /* returns the next known section. * if section == NULL returns first section.