Skip to contentSkip to conversation

sx memleak.

PATCH [email protected] 1 participant 1 message May 15, 2003 Char and misc drivers

lore
Share & tools
lore
#0 lore raw
drivers/char/sx.c +3 -1
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/sx.c linux-2.5/drivers/char/sx.c
@@ -1739,8 +1739,10 @@ static int sx_fw_ioctl (struct inode *in
 				if (copy_from_user(tmp, (char *)data + i, 
 						   (i + SX_CHUNK_SIZE >
 						    nbytes) ? nbytes - i :
-						   	      SX_CHUNK_SIZE))
+						   	      SX_CHUNK_SIZE)) {
+					kfree (tmp);
 					return -EFAULT;
+				}
 				memcpy_toio    ((char *) (board->base2 + offset + i), tmp, 
 				                (i+SX_CHUNK_SIZE>nbytes)?nbytes-i:SX_CHUNK_SIZE);
 			}