Staging: Fix leak in drivers/staging/at76_usb.c
[sfrench/cifs-2.6.git] / drivers / staging / at76_usb / at76_usb.c
index 52df0c665183cd24e8ad7e14ce1ec83682aa1ae1..174e2bec922323775f9fefa99927bdc98bd71e1d 100644 (file)
@@ -2319,9 +2319,11 @@ static int at76_iw_handler_get_scan(struct net_device *netdev,
        if (!iwe)
                return -ENOMEM;
 
-       if (priv->scan_state != SCAN_COMPLETED)
+       if (priv->scan_state != SCAN_COMPLETED) {
                /* scan not yet finished */
+               kfree(iwe);
                return -EAGAIN;
+       }
 
        spin_lock_irqsave(&priv->bss_list_spinlock, flags);