esp32_wifi_adapter.c: Fix a use-after-free bug

This commit is contained in:
YAMAMOTO Takashi 2020-12-17 16:31:26 +09:00 committed by Xiang Xiao
parent 75bc489e24
commit 48ba0bb30a

View File

@ -3114,13 +3114,14 @@ static int32_t esp_nvs_get_blob(uint32_t handle,
fd = open(dir, O_RDONLY, NVS_FILE_MODE);
if (fd < 0)
{
free(dir);
if (errno == ENOENT)
{
wlinfo("INFO: No file %s\n", dir);
free(dir);
return ESP_ERR_NVS_NOT_FOUND;
}
wlerr("ERROR: Failed to get open %s\n", dir);
free(dir);
return -1;
}