[openib-general] [PATCH] Fix panic and memory leak in SA Query.
Roland Dreier
roland at topspin.com
Mon Nov 8 11:21:35 PST 2004
I think this should be better:
Index: core/sa_query.c
===================================================================
--- core/sa_query.c (revision 1175)
+++ core/sa_query.c (working copy)
@@ -544,12 +544,13 @@
ib_pack(path_rec_table, ARRAY_SIZE(path_rec_table),
rec, query->sa_query.mad->data);
+ *sa_query = &query->sa_query;
ret = send_mad(&query->sa_query, timeout_ms);
if (ret) {
+ *sa_query = NULL;
kfree(query->sa_query.mad);
kfree(query);
- } else
- *sa_query = &query->sa_query;
+ }
return ret ? ret : query->sa_query.id;
}
@@ -619,12 +620,13 @@
ib_pack(mcmember_rec_table, ARRAY_SIZE(mcmember_rec_table),
rec, query->sa_query.mad->data);
+ *sa_query = &query->sa_query;
ret = send_mad(&query->sa_query, timeout_ms);
if (ret) {
+ *sa_query = NULL;
kfree(query->sa_query.mad);
kfree(query);
- } else
- *sa_query = &query->sa_query;
+ }
return ret ? ret : query->sa_query.id;
}
More information about the general
mailing list