Patchwork [05/23] UBI: Fastmap: Fix memory corruption

login
register
mail settings
Submitter Richard Weinberger
Date June 1, 2012, 3:16 p.m.
Message ID <1338563804-85990-6-git-send-email-richard@nod.at>
Download mbox | patch
Permalink /patch/162327/
State New
Headers show

Comments

Richard Weinberger - June 1, 2012, 3:16 p.m.
Use ubi_zalloc_vid_hdr().

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 drivers/mtd/ubi/fastmap.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Patch

diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index 2326e5a..cbd8c0c 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -1067,7 +1067,8 @@  static int ubi_write_fastmap(struct ubi_device *ubi,
 	dbg_bld("Fastmap written!");
 
 out_kfree:
-	kfree(avhdr);
+	ubi_free_vid_hdr(ubi, avhdr);
+	ubi_free_vid_hdr(ubi, dvhdr);
 out_vfree:
 	vfree(fm_raw);
 out: