Skip to contentSkip to conversation

librdmacm: Fix resource leak in error flow

PATCH In review Dotan Barak 2 participants 2 messages Aug 15, 2011 – Aug 22, 2011 2 messages not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 librdmacm: Fix resource leak in error flow

Prevent resource leak by destroying the event channel before returning from function in an error flow.

---

src/cma.c +4 -1
index bad1ba3..1367779 100755
@@ -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