cxgb4: fix memory leak of qe on error exit path
authorColin Ian King <colin.king@canonical.com>
Sun, 16 Oct 2016 22:54:03 +0000 (23:54 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 17 Oct 2016 15:24:08 +0000 (11:24 -0400)
A memory leak of qe occurs when t4_sched_queue_unbind fails,
so fix this by free'ing qe on the error exit path.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/chelsio/cxgb4/sched.c

index 539de76..cbd68a8 100644 (file)
@@ -210,8 +210,10 @@ static int t4_sched_queue_bind(struct port_info *pi, struct ch_sched_queue *p)
 
        /* Unbind queue from any existing class */
        err = t4_sched_queue_unbind(pi, p);
-       if (err)
+       if (err) {
+               t4_free_mem(qe);
                goto out;
+       }
 
        /* Bind queue to specified class */
        memset(qe, 0, sizeof(*qe));