patch-2.4.5 linux/drivers/mtd/mtdchar.c

Next file: linux/drivers/mtd/nftl.c
Previous file: linux/drivers/mtd/mtdblock.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.4/linux/drivers/mtd/mtdchar.c linux/drivers/mtd/mtdchar.c
@@ -310,8 +310,10 @@
 		if (!databuf)
 			return -ENOMEM;
 		
-		if (copy_from_user(databuf, buf.ptr, buf.length))
+		if (copy_from_user(databuf, buf.ptr, buf.length)) {
+			kfree(databuf);
 			return -EFAULT;
+		}
 
 		ret = (mtd->write_oob)(mtd, buf.start, buf.length, &retlen, databuf);
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)