config_set_string - prevent potential crash

This commit is contained in:
twinaphex 2016-08-20 21:20:52 +02:00
parent 616f517de7
commit 7f3e63a18d

View File

@ -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);