summaryrefslogtreecommitdiff
path: root/env/sf.c
diff options
context:
space:
mode:
Diffstat (limited to 'env/sf.c')
-rw-r--r--env/sf.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/env/sf.c b/env/sf.c
index 1c2ab9da9b..ba5f7919c1 100644
--- a/env/sf.c
+++ b/env/sf.c
@@ -154,6 +154,9 @@ static int env_sf_save(void)
printf("Valid environment: %d\n", (int)gd->env_valid);
done:
+ spi_flash_free(env_flash);
+ env_flash = NULL;
+
if (saved_buffer)
free(saved_buffer);
@@ -255,6 +258,9 @@ static int env_sf_save(void)
puts("done\n");
done:
+ spi_flash_free(env_flash);
+ env_flash = NULL;
+
if (saved_buffer)
free(saved_buffer);
@@ -413,6 +419,9 @@ static int env_sf_init_early(void)
gd->env_addr = (unsigned long)&tmp_env1->data;
}
+ spi_flash_free(env_flash);
+ env_flash = NULL;
+
return 0;
err_read:
spi_flash_free(env_flash);