[PATCH] lcd: fix memory leak in lcd_ioctl()

Linux Kernel Mailing List <[email protected]>
Newsgroups gmane.linux.kernel.commits.2-4
Message-ID <[email protected]>
ChangeSet 1.1588, 2005/01/29 14:26:17-02:00, [email protected]

	[PATCH] lcd: fix memory leak in lcd_ioctl()
	
	This patch fixes a memory leak in the FLASH_Burn ioctl for the Cobalt LCD interface driver.
	
	Signed-off-by: James Nelson <[email protected]>



 lcd.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)


diff -Nru a/drivers/char/lcd.c b/drivers/char/lcd.c
--- a/drivers/char/lcd.c	2005-01-30 15:37:24 -08:00
+++ b/drivers/char/lcd.c	2005-01-30 15:37:24 -08:00
@@ -438,8 +438,10 @@
 		save_flags(flags);
 		for (i=0; i<FLASH_SIZE; i=i+128) {
 
-		        if(copy_from_user(rom, display.RomImage + i, 128))
+		        if(copy_from_user(rom, display.RomImage + i, 128)) {
+			   kfree(rom);
 			   return -EFAULT;
+			}
 			burn_addr = kFlashBase + i;
 			cli();
 			for ( index = 0; index < ( 128 ) ; index++ )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.