aboutsummaryrefslogtreecommitdiff
path: root/drivers/char/agp/amd-k7-agp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/agp/amd-k7-agp.c')
-rw-r--r--drivers/char/agp/amd-k7-agp.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
index 51d0d562d01..c85c8cadb6d 100644
--- a/drivers/char/agp/amd-k7-agp.c
+++ b/drivers/char/agp/amd-k7-agp.c
@@ -101,6 +101,11 @@ static int amd_create_gatt_pages(int nr_tables)
for (i = 0; i < nr_tables; i++) {
entry = kzalloc(sizeof(struct amd_page_map), GFP_KERNEL);
if (entry == NULL) {
+ while (i > 0) {
+ kfree(tables[i-1]);
+ i--;
+ }
+ kfree(tables);
retval = -ENOMEM;
break;
}