patch-2.4.1 linux/drivers/video/sbusfb.c

Next file: linux/drivers/video/vfb.c
Previous file: linux/drivers/usb/storage/usb.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0/linux/drivers/video/sbusfb.c linux/drivers/video/sbusfb.c
@@ -678,7 +678,7 @@
 		int end, count, index;
 		struct fbcmap *cmap;
 		
-		if (!fb->loadcmap)
+		if (!fb->loadcmap || !fb->color_map)
 			return -EINVAL;
 		i = verify_area (VERIFY_READ, (void *) arg, sizeof (struct fbcmap));
 		if (i) return i;
@@ -1110,6 +1110,8 @@
 	}
 	
 	if (!p) {
+		if (fb->color_map)
+			kfree(fb->color_map);
 		kfree(fb);
 		return;
 	}
@@ -1147,6 +1149,8 @@
 	sbusfb_set_var(var, -1, &fb->info);
 
 	if (register_framebuffer(&fb->info) < 0) {
+		if (fb->color_map)
+			kfree(fb->color_map);
 		kfree(fb);
 		return;
 	}

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