From 317f481b9567196e3d24e84bd64d091ccdb2d0d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Higor=20Eur=C3=ADpedes?= Date: Wed, 20 May 2015 10:02:33 -0300 Subject: [PATCH] (config_file.c) Fix error when path is not a regular file --- libretro-common/file/config_file.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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);