OSDN Git Service

firestream: fix memory leaks
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / drivers / atm / firestream.c
index 82f2ae0..04b39d0 100644 (file)
@@ -923,6 +923,7 @@ static int fs_open(struct atm_vcc *atm_vcc)
                        }
                        if (!to) {
                                printk ("No more free channels for FS50..\n");
+                               kfree(vcc);
                                return -EBUSY;
                        }
                        vcc->channo = dev->channo;
@@ -933,6 +934,7 @@ static int fs_open(struct atm_vcc *atm_vcc)
                        if (((DO_DIRECTION(rxtp) && dev->atm_vccs[vcc->channo])) ||
                            ( DO_DIRECTION(txtp) && test_bit (vcc->channo, dev->tx_inuse))) {
                                printk ("Channel is in use for FS155.\n");
+                               kfree(vcc);
                                return -EBUSY;
                        }
                }
@@ -946,6 +948,7 @@ static int fs_open(struct atm_vcc *atm_vcc)
                            tc, sizeof (struct fs_transmit_config));
                if (!tc) {
                        fs_dprintk (FS_DEBUG_OPEN, "fs: can't alloc transmit_config.\n");
+                       kfree(vcc);
                        return -ENOMEM;
                }