patch-2.0.33 linux/mm/vmalloc.c

Next file: linux/mm/vmscan.c
Previous file: linux/mm/page_alloc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.32/linux/mm/vmalloc.c linux/mm/vmalloc.c
@@ -143,8 +143,10 @@
 		pte_t * pte = pte_alloc_kernel(pmd, address);
 		if (!pte)
 			return -ENOMEM;
-		if (alloc_area_pte(pte, address, end - address))
+		if (alloc_area_pte(pte, address, end - address)) {
+			pte_free_kernel(pte);
 			return -ENOMEM;
+		}
 		address = (address + PMD_SIZE) & PMD_MASK;
 		pmd++;
 	}
@@ -162,8 +164,10 @@
 		pmd_t *pmd = pmd_alloc_kernel(dir, address);
 		if (!pmd)
 			return -ENOMEM;
-		if (alloc_area_pmd(pmd, address, end - address))
+		if (alloc_area_pmd(pmd, address, end - address)) {
+			pmd_free_kernel(pmd);
 			return -ENOMEM;
+		}
 		set_pgdir(address, *dir);
 		address = (address + PGDIR_SIZE) & PGDIR_MASK;
 		dir++;
@@ -224,8 +228,10 @@
 		pmd_t *pmd = pmd_alloc_kernel(dir, address);
 		if (!pmd)
 			return -ENOMEM;
-		if (remap_area_pmd(pmd, address, end - address, offset + address))
+		if (remap_area_pmd(pmd, address, end - address, offset + address)) {
+			pmd_free_kernel(pmd);
 			return -ENOMEM;
+		}
 		set_pgdir(address, *dir);
 		address = (address + PGDIR_SIZE) & PGDIR_MASK;
 		dir++;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov