aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2021-06-07 12:32:45 +0200
committerlonkaars <loek@pipeframe.xyz>2021-06-07 12:32:45 +0200
commit39643640b1a64877157373d149a3a7dbd9cbc6c2 (patch)
tree1c448367fcfa737713acc8e0612bccdee254c26a
parentbca8a2361c587ed6662a73f36cec964c23c7333b (diff)
fix segfault on undefined optional config props
-rw-r--r--musicopy.c14
1 files 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;
}