USB: ene_ub6250: fix memory leak in ene_load_bincode()
authorDan Carpenter <error27@gmail.com>
Thu, 10 Mar 2011 08:31:33 +0000 (11:31 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 11 Mar 2011 22:26:08 +0000 (14:26 -0800)
"buf" gets allocated twice in a row.  It's the second allocation which
is correct.  The first one should be removed.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: huajun li <huajun.li.lee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/storage/ene_ub6250.c

index 058c5d5f1c1eaaa73e47ec48e9a03fc436118b88..08e03745e251da230f3017b3b5bf8905954760c0 100644 (file)
@@ -491,10 +491,6 @@ static int ene_load_bincode(struct us_data *us, unsigned char flag)
        if (info->BIN_FLAG == flag)
                return USB_STOR_TRANSPORT_GOOD;
 
-       buf = kmalloc(ENE_BIN_CODE_LEN, GFP_KERNEL);
-       if (buf == NULL)
-               return USB_STOR_TRANSPORT_ERROR;
-
        switch (flag) {
        /* For SD */
        case SD_INIT1_PATTERN: