From 7f3e63a18df462552018b8393ca50cb95b008033 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 20 Aug 2016 21:20:52 +0200 Subject: [PATCH] config_set_string - prevent potential crash --- libretro-common/file/config_file.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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);