1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-02 19:32:19 +01:00
This commit is contained in:
J. Nick Koston
2025-08-14 22:42:19 -05:00
parent e9e94bcd45
commit 9f4d0d3f23

View File

@@ -168,7 +168,7 @@ class ESP32Preferences : public ESPPreferences {
return true; return true;
} }
// Use unique_ptr to avoid vector overhead for temporary comparison // Use unique_ptr to avoid vector overhead for temporary comparison
std::unique_ptr<uint8_t[]> stored_data(new uint8_t[actual_len]); auto stored_data = std::make_unique<uint8_t[]>(actual_len);
err = nvs_get_blob(nvs_handle, to_save.key.c_str(), stored_data.get(), &actual_len); err = nvs_get_blob(nvs_handle, to_save.key.c_str(), stored_data.get(), &actual_len);
if (err != 0) { if (err != 0) {
ESP_LOGV(TAG, "nvs_get_blob('%s') failed: %s", to_save.key.c_str(), esp_err_to_name(err)); ESP_LOGV(TAG, "nvs_get_blob('%s') failed: %s", to_save.key.c_str(), esp_err_to_name(err));