Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/littlefs-project/littlefs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Haster <chaster@utexas.edu>2018-08-11 21:45:13 +0300
committerChristopher Haster <chaster@utexas.edu>2018-10-18 18:00:48 +0300
commit38011f4cd0e31295f1b25abf72d61e7c7f3827ec (patch)
treed92af5f9d148afd0496aca7e7b40aa367db210bd
parent126ef8b07fc5f111fa2e3b4076441471dcd2e40e (diff)
Fixed minor memory leak
- Fixed memory leak - Change lfs_globals_zero to use memset as this made leak checking more effective - Checked for leaks with valgrind
-rw-r--r--lfs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lfs.c b/lfs.c
index 24900c0..ec0792d 100644
--- a/lfs.c
+++ b/lfs.c
@@ -447,7 +447,7 @@ static inline bool lfs_global_iszero(const lfs_global_t *a) {
}
static inline void lfs_global_zero(lfs_global_t *a) {
- lfs_global_xor(a, a);
+ memset(a, 0, sizeof(lfs_global_t));
}
static inline void lfs_global_fromle32(lfs_global_t *a) {
@@ -2083,7 +2083,7 @@ int lfs_file_close(lfs_t *lfs, lfs_file_t *file) {
}
// clean up memory
- if (file->cfg->buffer) {
+ if (!file->cfg->buffer) {
lfs_free(file->cache.buffer);
}