Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c30efbaeaa9297fb1a35ef952350e0c2bb7a3d47
Commit:     c30efbaeaa9297fb1a35ef952350e0c2bb7a3d47
Parent:     4b95320fc4d21b0ff2f8604305dd6c851aff6096
Author:     Dave Jones <[EMAIL PROTECTED]>
AuthorDate: Sun Jan 28 17:39:19 2007 -0500
Committer:  Dave Jones <[EMAIL PROTECTED]>
CommitDate: Sun Jan 28 17:39:19 2007 -0500

    [AGPGART] Prevent (unlikely) memory leak in amd_create_gatt_pages()
    
    If we fail an alloc, unwind the previous allocs that succeeded.
    
    Spotted-by: Alan Grimes <[EMAIL PROTECTED]>
    Signed-off-by: Dave Jones <[EMAIL PROTECTED]>
---
 drivers/char/agp/amd-k7-agp.c |    5 +++++
 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 51d0d56..c85c8ca 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;
                }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to