From 39643640b1a64877157373d149a3a7dbd9cbc6c2 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Mon, 7 Jun 2021 12:32:45 +0200 Subject: fix segfault on undefined optional config props --- musicopy.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/musicopy.c b/musicopy.c index dc05d9e..3908f2e 100644 --- a/musicopy.c +++ b/musicopy.c @@ -179,12 +179,19 @@ void load_config() { exclude_length = 0; include_length = 0; - existing = strdup(""); - music_dir = strdup(""); - playlist_dir = strdup(""); + + music_dir = strdup(""); + playlist_dir = strdup(""); + target_music_dir = strdup(""); target_playlist_dir = strdup(""); + existing = strdup(""); + + playlist_prefix = strdup(""); + target_playlist_prefix = strdup(""); + change_playlist_extension = strdup(""); + if (ini_parse(config_path, ini_callback, NULL) < 0) exit_err("Can't load configuration file!"); } @@ -323,6 +330,7 @@ int playlist_dir_callback(const char* path, const struct stat *sb, int tflag) { if(dest_playlist == NULL) { fprintf(stderr, "couldn't open playlist \'%s\' in `int playlist_dir_callback()`, skipping...\n", destpath); + fclose(source_playlist); return 0; } -- cgit v1.2.3