Skip to contentSkip to conversation

saquery.c: resource leak

PATCH Applied Hal Rosenstock 2 participants 2 messages Jun 12, 2013 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 6/6 saquery.c: resource leak

From: Dan Ben Yosef <[email protected]>

Overwriting "node_name" in call "node_name = remap_node_name(node_name_map, nr->node_info.node_guid, (char*)nr->node_desc.description)" leaks the storage that "node_name" points to.

---
 src/saquery.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
src/saquery.c +2 -0
index d31d77d..ca223c6 100644
@@ -365,6 +365,8 @@ static void dump_multicast_member_record(ib_member_rec_t *p_mcmr,
 		ib_node_record_t *nr = sa_get_query_rec(nr_result->p_result_madw, i);
 		if (nr->node_info.port_guid ==
 		    p_mcmr->port_gid.unicast.interface_id) {
+			if(node_name != NULL)
+				free(node_name);
 			node_name = remap_node_name(node_name_map,
 						nr->node_info.node_guid,
 						(char *)nr->node_desc.description);
Signature · 6 lines
1.7.8.2

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

A message that is not in the archive (sent off-list or not yet received): 51B87DE9.1090902-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org

Applied
#2 lore raw
Quoted 1 line · On Wed, 12 Jun 2013 09:55:53 -0400 Hal Rosenstock…

From: Dan Ben Yosef <[email protected]>

Thanks applied!
Ira

Quoted 27 lines

Overwriting "node_name" in call "node_name = remap_node_name(node_name_map, nr->node_info.node_guid, (char*)nr->node_desc.description)" leaks the storage that "node_name" points to.

---
 src/saquery.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
src/saquery.c +2 -0
index d31d77d..ca223c6 100644
@@ -365,6 +365,8 @@ static void dump_multicast_member_record(ib_member_rec_t *p_mcmr,
 		ib_node_record_t *nr = sa_get_query_rec(nr_result->p_result_madw, i);
 		if (nr->node_info.port_guid ==
 		    p_mcmr->port_gid.unicast.interface_id) {
+			if(node_name != NULL)
+				free(node_name);
 			node_name = remap_node_name(node_name_map,
 						nr->node_info.node_guid,
 						(char *)nr->node_desc.description);
Signature · 1 line
1.7.8.2
Signature · 5 lines
Ira Weiny <[email protected]>
--
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