net/ice: fix hash flow crash
[dpdk.git] / drivers / net / ice / ice_hash.c
index b145a3f..0e9c3c4 100644 (file)
@@ -424,12 +424,14 @@ ice_hash_parse_pattern_action(__rte_unused struct ice_adapter *ad,
        /* Check rss supported pattern and find matched pattern. */
        pattern_match_item = ice_search_pattern_match_item(pattern,
                                        array, array_len, error);
-       if (!pattern_match_item)
-               return -rte_errno;
+       if (!pattern_match_item) {
+               ret = -rte_errno;
+               goto error;
+       }
 
        ret = ice_hash_check_inset(pattern, error);
        if (ret)
-               return -rte_errno;
+               goto error;
 
        /* Save protocol header to rss_meta. */
        *meta = rss_meta_ptr;
@@ -438,12 +440,12 @@ ice_hash_parse_pattern_action(__rte_unused struct ice_adapter *ad,
 
        /* Check rss action. */
        ret = ice_hash_parse_action(pattern_match_item, actions, meta, error);
+error:
        if (ret)
-               return -rte_errno;
-
+               rte_free(rss_meta_ptr);
        rte_free(pattern_match_item);
 
-       return 0;
+       return ret;
 }
 
 static int