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

Submitted by Richard Weinberger on June 1, 2012, 3:16 p.m.

Details

Message ID 1338563804-85990-6-git-send-email-richard@nod.at
State New, archived
Headers show

Commit Message

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 hide | download patch | download mbox

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: