[ofa-general] [PATCH] librdmacm: Fix memory leak reported by valgrind

Dotan Barak dotanb at dev.mellanox.co.il
Tue Aug 14 05:00:15 PDT 2007


Fix memory leak reported by valgrind:
==6239== 16 bytes in 1 blocks are definitely lost in loss record 2 of 10
==6239==    at 0x4A04CBF: calloc (vg_replace_malloc.c:279)
==6239==    by 0x4E386C4: ibv_get_device_list@@IBVERBS_1.1 (device.c:65)
==6239==    by 0x4C2D868: ucma_init (cma.c:221)
==6239==    by 0x4C2F831: rdma_create_event_channel (cma.c:299)
==6239==    by 0x4018A5: main (cmatose.c:650)

Signed-off-by: Dotan Barak <dotanb at dev.mellanox.co.il>

---

diff --git a/src/cma.c b/src/cma.c
index 3579530..32edc1f 100644
--- a/src/cma.c
+++ b/src/cma.c
@@ -238,6 +238,7 @@ static int ucma_init(void)
 	}
 out:
 	pthread_mutex_unlock(&mut);
+	ibv_free_device_list(dev_list);
 	return 0;
 err:
 	ucma_cleanup();



More information about the general mailing list