isdn/gigaset: fix leaks in error path
authorTilman Schmidt <tilman@imap.cc>
Mon, 5 Jul 2010 14:19:19 +0000 (14:19 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 7 Jul 2010 23:57:55 +0000 (16:57 -0700)
Take care to free all previously allocated ressources in the
"out of memory" error path of the ISDN_CMD_DIAL branch.
Based on an original patch by Dan Carpenter.

Impact: bugfix
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Acked-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/isdn/gigaset/i4l.c

index 1d084bb..34bca37 100644 (file)
@@ -419,6 +419,8 @@ oom:
        dev_err(bcs->cs->dev, "out of memory\n");
        for (i = 0; i < AT_NUM; ++i)
                kfree(commands[i]);
+       kfree(commands);
+       gigaset_free_channel(bcs);
        return -ENOMEM;
 }