patch-1.3.78 linux/drivers/char/pty.c

Next file: linux/drivers/char/tga.c
Previous file: linux/drivers/char/lp.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.77/linux/drivers/char/pty.c linux/drivers/char/pty.c
@@ -195,9 +195,13 @@
 	tty->driver_data = pty;
 
 	if (!tmp_buf) {
-		tmp_buf = (unsigned char *) get_free_page(GFP_KERNEL);
-		if (!tmp_buf)
-			return -ENOMEM;
+		unsigned long page = get_free_page(GFP_KERNEL);
+		if (!tmp_buf) {
+			if (!page)
+				return -ENOMEM;
+			tmp_buf = (unsigned char *) page;
+		} else
+			free_page(page);
 	}
 
 	if (tty->driver.subtype == PTY_TYPE_SLAVE)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this