Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d9a2f4a4945ebff54c9a011e4dc6e92d899ae26d
Commit:     d9a2f4a4945ebff54c9a011e4dc6e92d899ae26d
Parent:     fd463870dc89cac0f590ea007e3a5210103b1b04
Author:     Amit Choudhary <[EMAIL PROTECTED]>
AuthorDate: Tue May 8 00:26:13 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue May 8 11:15:02 2007 -0700

    drivers/char/synclink.c: check kmalloc() return value
    
    Signed-off-by: Amit Choudhary <[EMAIL PROTECTED]>
    Cc: Paul Fulghum <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 drivers/char/synclink.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index ce4db6f..f02a079 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -4010,8 +4010,13 @@ static int 
mgsl_alloc_intermediate_txbuffer_memory(struct mgsl_struct *info)
        for ( i=0; i<info->num_tx_holding_buffers; ++i) {
                info->tx_holding_buffers[i].buffer =
                        kmalloc(info->max_frame_size, GFP_KERNEL);
-               if ( info->tx_holding_buffers[i].buffer == NULL )
+               if (info->tx_holding_buffers[i].buffer == NULL) {
+                       for (--i; i >= 0; i--) {
+                               kfree(info->tx_holding_buffers[i].buffer);
+                               info->tx_holding_buffers[i].buffer = NULL;
+                       }
                        return -ENOMEM;
+               }
        }
 
        return 0;
-
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