Prevent resource leak by destroying the event channel before returning from function in an error flow.
Signed-off-by: Dotan Barak <[email protected]> --- diff --git a/src/cma.c b/src/cma.c index bad1ba3..1367779 100755 --- a/src/cma.c +++ b/src/cma.c @@ -2122,8 +2122,11 @@ int rdma_migrate_id(struct rdma_cm_id *id, struct rdma_event_channel *channel) cmd->fd = id->channel->fd; ret = write(channel->fd, msg, size); - if (ret != size) + if (ret != size) { + if (sync) + rdma_destroy_event_channel(channel); return (ret >= 0) ? ERR(ENODATA) : -1; + } VALGRIND_MAKE_MEM_DEFINED(resp, sizeof *resp); -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
