summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/jffs2/jffs2_1pass.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index 7bfcc04..24b446c 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -217,7 +217,8 @@ static void *get_fl_mem(u32 off, u32 size, void *ext_buf)
return NULL;
}
if (read_nand_cached(off, size, buf) < 0) {
- free(buf);
+ if (!ext_buf)
+ free(buf);
return NULL;
}
@@ -756,9 +757,11 @@ jffs2_1pass_list_inodes(struct b_lists * pL, u32 pino)
while (b2) {
jNode = (struct jffs2_raw_inode *)
get_fl_mem(b2->offset, sizeof(ojNode), &ojNode);
- if (jNode->ino == jDir->ino
- && jNode->version >= i_version)
+ if (jNode->ino == jDir->ino && jNode->version >= i_version) {
+ if (i)
+ put_fl_mem(i);
i = get_fl_mem(b2->offset, sizeof(*i), NULL);
+ }
b2 = b2->next;
}