From: Dan Ben Yosef <[email protected]>

Variable "head" going out of scope leaks the storage it points to.

Signed-off-by: Dan Ben Yosef <[email protected]>
Signed-off-by: Jens Domke <[email protected]>
---
 opensm/osm_ucast_dfsssp.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/opensm/osm_ucast_dfsssp.c b/opensm/osm_ucast_dfsssp.c
index ff525ea..013bad4 100644
--- a/opensm/osm_ucast_dfsssp.c
+++ b/opensm/osm_ucast_dfsssp.c
@@ -1161,6 +1161,11 @@ static int dfsssp_build_graph(void *context)
                                OSM_LOG(p_mgr->p_log, OSM_LOG_ERROR,
                                        "ERR AD08: cannot allocate memory for a 
link\n");
                                dfsssp_context_destroy(context);
+                               while (head) {
+                                       link = head;
+                                       head = head->next;
+                                       free(link);
+                                }
                                return 1;
                        }
                        link = link->next;
-- 
1.7.1

--
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

Reply via email to