[ofw] [PATCH 1/2] compat-dapl-1.2: cma: memory leak of FD's (pipe) created during dat_evd_create

Davis, Arlin R arlin.r.davis at intel.com
Wed May 19 09:42:49 PDT 2010


Add checking for pipe FD's during destroy and clean them up with close.

Signed-off-by: Arlin Davis <arlin.r.davis at intel.com>
---
 dapl/openib_cma/dapl_ib_cq.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/dapl/openib_cma/dapl_ib_cq.c b/dapl/openib_cma/dapl_ib_cq.c
index cf19f38..c54bbaf 100644
--- a/dapl/openib_cma/dapl_ib_cq.c
+++ b/dapl/openib_cma/dapl_ib_cq.c
@@ -462,8 +462,11 @@ dapls_ib_wait_object_create(IN DAPL_EVD *evd_ptr,
 		ibv_create_comp_channel(
 			evd_ptr->header.owner_ia->hca_ptr->ib_hca_handle);	
 		
-	if ((*p_cq_wait_obj_handle)->events == NULL) 		
+	if ((*p_cq_wait_obj_handle)->events == NULL) {
+		close((*p_cq_wait_obj_handle)->pipe[0]);
+		close((*p_cq_wait_obj_handle)->pipe[1]);
 		goto bail;
+	}
 
 	return DAT_SUCCESS;
 bail:
@@ -483,6 +486,9 @@ dapls_ib_wait_object_destroy(IN ib_wait_obj_handle_t p_cq_wait_obj_handle)
 	
 	ibv_destroy_comp_channel(p_cq_wait_obj_handle->events);
 
+	close(p_cq_wait_obj_handle->pipe[0]);
+	close(p_cq_wait_obj_handle->pipe[1]);
+
 	dapl_os_free(p_cq_wait_obj_handle, 
 		     sizeof(struct _ib_wait_obj_handle));
 
-- 
1.5.2.5




More information about the ofw mailing list