diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c index 55eccc793a..2ceaffc0e6 100644 --- a/libretro-common/file/config_file.c +++ b/libretro-common/file/config_file.c @@ -771,8 +771,12 @@ void config_set_string(config_file_t *conf, const char *key, const char *val) entry = (struct config_entry_list*)calloc(1, sizeof(*entry)); - if (!entry) + if (!entry || !val) + { + if (entry) + free(entry); return; + } entry->key = strdup(key); entry->value = strdup(val);