projects
/
GitHub
/
LineageOS
/
android_kernel_motorola_exynos9610.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4b95320
)
[AGPGART] Prevent (unlikely) memory leak in amd_create_gatt_pages()
author
Dave Jones
<davej@redhat.com>
Sun, 28 Jan 2007 22:39:19 +0000
(17:39 -0500)
committer
Dave Jones
<davej@redhat.com>
Sun, 28 Jan 2007 22:39:19 +0000
(17:39 -0500)
If we fail an alloc, unwind the previous allocs that succeeded.
Spotted-by: Alan Grimes <agrimes@speakeasy.net>
Signed-off-by: Dave Jones <davej@redhat.com>
drivers/char/agp/amd-k7-agp.c
patch
|
blob
|
blame
|
history
diff --git
a/drivers/char/agp/amd-k7-agp.c
b/drivers/char/agp/amd-k7-agp.c
index 51d0d562d01e11bc8e457ac4a02dfbf331c2b464..c85c8cadb6dfd67b9531eb849f140e9095deec9a 100644
(file)
--- 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;
}