diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c index 7b0ce56158..3c23c7fa6f 100644 --- a/libretro-common/file/config_file.c +++ b/libretro-common/file/config_file.c @@ -362,9 +362,16 @@ static config_file_t *config_file_new_internal( if (!conf) return NULL; - if (!path) + if (!path || !*path) return conf; + if (path_is_directory(path)) + { + RARCH_ERR("%s is not a regular file.\n", path); + free(conf); + return NULL; + } + conf->path = strdup(path); if (!conf->path) { @@ -411,6 +418,11 @@ static config_file_t *config_file_new_internal( free(line); } + else + { + free(list); + continue; + } if (list != conf->tail) free(list);