iser-target: Fix leak on failure in isert_conn_create_fastreg_pool
authorNicholas Bellinger <nab@linux-iscsi.org>
Mon, 3 Feb 2014 20:59:56 +0000 (12:59 -0800)
committerNicholas Bellinger <nab@linux-iscsi.org>
Wed, 12 Feb 2014 23:14:11 +0000 (15:14 -0800)
commita80e21b3b2d151d79bb9be42334ab10d40195324
tree13e36709850e75884e51785516a4835a689f6b09
parent752d86805b18e58c56c6f3c7004c2dffd4430c17
iser-target: Fix leak on failure in isert_conn_create_fastreg_pool

This patch fixes a memory leak for fr_desc upon failure of
isert_create_fr_desc() in isert_conn_create_fastreg_pool()
code.

As reported by Coverity 1166659:

*** CID 1166659:  Resource leak  (RESOURCE_LEAK)
/drivers/infiniband/ulp/isert/ib_isert.c: 470 in isert_conn_create_fastreg_pool()
464                      isert_conn, isert_conn->conn_fr_pool_size);
465
466             return 0;
467
468     err:
469             isert_conn_free_fastreg_pool(isert_conn);
>>>     CID 1166659:  Resource leak  (RESOURCE_LEAK)
>>>     Variable "fr_desc" going out of scope leaks the storage it points to.
470             return ret;
471     }
472
473     static int
474     isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
475     {

Cc: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/infiniband/ulp/isert/ib_isert.c