diff --git a/components/nvs_flash/include/nvs_handle.hpp b/components/nvs_flash/include/nvs_handle.hpp index 287866fad6..b09d013d22 100644 --- a/components/nvs_flash/include/nvs_handle.hpp +++ b/components/nvs_flash/include/nvs_handle.hpp @@ -224,7 +224,7 @@ protected: * - ESP_ERR_NVS_INVALID_NAME if namespace name doesn't satisfy constraints * - other error codes from the underlying storage driver * - * @return shared pointer of an nvs handle on success, an empty shared pointer otherwise + * @return unique pointer of an nvs handle on success, an empty unique pointer otherwise */ std::unique_ptr open_nvs_handle_from_partition(const char *partition_name, const char *ns_name, diff --git a/examples/storage/nvs_rw_value_cxx/main/nvs_value_example_main.cpp b/examples/storage/nvs_rw_value_cxx/main/nvs_value_example_main.cpp index 7fa0891c26..ac03a6a413 100644 --- a/examples/storage/nvs_rw_value_cxx/main/nvs_value_example_main.cpp +++ b/examples/storage/nvs_rw_value_cxx/main/nvs_value_example_main.cpp @@ -32,9 +32,8 @@ extern "C" void app_main(void) // Open printf("\n"); printf("Opening Non-Volatile Storage (NVS) handle... "); - esp_err_t result; // Handle will automatically close when going out of scope or when it's reset. - std::shared_ptr handle = nvs::open_nvs_handle("storage", NVS_READWRITE, &result); + std::unique_ptr handle = nvs::open_nvs_handle("storage", NVS_READWRITE, &err); if (err != ESP_OK) { printf("Error (%s) opening NVS handle!\n", esp_err_to_name(err)); } else {