diff options
author | lonkaars <loek@pipeframe.xyz> | 2021-06-07 12:32:45 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2021-06-07 12:32:45 +0200 |
commit | 39643640b1a64877157373d149a3a7dbd9cbc6c2 (patch) | |
tree | 1c448367fcfa737713acc8e0612bccdee254c26a | |
parent | bca8a2361c587ed6662a73f36cec964c23c7333b (diff) |
fix segfault on undefined optional config props
-rw-r--r-- | musicopy.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -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; } |