Skip to contentSkip to conversation

opensm/osm_qos_parser_y.y: fixing bunch of memory leaks on invalid values

PATCH Applied Yevgeny Kliteynik 2 participants 2 messages Sep 7, 2010 – Nov 30, 2010 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 opensm/osm_qos_parser_y.y: fixing bunch of memory leaks on invalid values

---
 opensm/opensm/osm_qos_parser_y.y |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
opensm/opensm/osm_qos_parser_y.y +6 -1
index 7118b79..d9830dc 100644
@@ -763,6 +763,7 @@ qos_ulp:            TK_ULP_DEFAULT single_number {
                             if (range_arr[i][0] > 0xFFFF || range_arr[i][1] > 0xFFFF)
                             {
                                 yyerror("SDP port number out of range");
+                                free(range_arr);
                                 return 1;
                             }
                             range_arr[i][0] += OSM_QOS_POLICY_ULP_SDP_SERVICE_ID;
@@ -809,6 +810,7 @@ qos_ulp:            TK_ULP_DEFAULT single_number {
                             if (range_arr[i][0] > 0xFFFF || range_arr[i][1] > 0xFFFF)
                             {
                                 yyerror("SDP port number out of range");
+                                free(range_arr);
                                 return 1;
                             }
                             range_arr[i][0] += OSM_QOS_POLICY_ULP_RDS_SERVICE_ID;
@@ -855,6 +857,7 @@ qos_ulp:            TK_ULP_DEFAULT single_number {
                             if (range_arr[i][0] > 0xFFFF || range_arr[i][1] > 0xFFFF)
                             {
                                 yyerror("SDP port number out of range");
+                                free(range_arr);
                                 return 1;
                             }
                             range_arr[i][0] += OSM_QOS_POLICY_ULP_ISER_SERVICE_ID;
@@ -944,8 +947,10 @@ qos_ulp:            TK_ULP_DEFAULT single_number {
                          * If some problem would be found, parsing will
                          * be aborted with a proper error messages.
                          */
-                        if (__validate_pkeys(range_arr, range_len, TRUE))
+                        if (__validate_pkeys(range_arr, range_len, TRUE)) {
+                            free(range_arr);
                             return 1;
+                        }
 
                         p_current_qos_match_rule->pkey_range_arr = range_arr;
                         p_current_qos_match_rule->pkey_range_len = range_len;
Signature · 6 lines
1.6.2.4

--
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): 4C8657A2.8020106-VPRAkNaXOzVS1MOuV/[email protected]