aboutsummaryrefslogtreecommitdiffstats
path: root/package/utils/nvram/src/nvram.c
diff options
context:
space:
mode:
Diffstat (limited to 'package/utils/nvram/src/nvram.c')
-rw-r--r--package/utils/nvram/src/nvram.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/package/utils/nvram/src/nvram.c b/package/utils/nvram/src/nvram.c
index 0e4294391a..ca89392107 100644
--- a/package/utils/nvram/src/nvram.c
+++ b/package/utils/nvram/src/nvram.c
@@ -380,7 +380,9 @@ nvram_handle_t * nvram_open(const char *file, int rdonly)
if( offset < 0 )
{
+ munmap(mmap_area, nvram_part_size);
free(mtd);
+ close(fd);
return NULL;
}
else if( (h = malloc(sizeof(nvram_handle_t))) != NULL )
@@ -410,6 +412,7 @@ nvram_handle_t * nvram_open(const char *file, int rdonly)
}
free(mtd);
+ close(fd);
return NULL;
}