net/softnic: fix memory leak as profile is freed
[dpdk.git] / drivers / net / softnic / rte_eth_softnic_action.c
index c542688..33be955 100644 (file)
@@ -183,6 +183,7 @@ softnic_table_action_profile_free(struct pmd_internals *p)
                        break;
 
                TAILQ_REMOVE(&p->table_action_profile_list, profile, node);
+               rte_table_action_profile_free(profile->ap);
                free(profile);
        }
 }
@@ -364,6 +365,39 @@ softnic_table_action_profile_create(struct pmd_internals *p,
                }
        }
 
+       if (params->action_mask & (1LLU << RTE_TABLE_ACTION_TAG)) {
+               status = rte_table_action_profile_action_register(ap,
+                       RTE_TABLE_ACTION_TAG,
+                       NULL);
+
+               if (status) {
+                       rte_table_action_profile_free(ap);
+                       return NULL;
+               }
+       }
+
+       if (params->action_mask & (1LLU << RTE_TABLE_ACTION_DECAP)) {
+               status = rte_table_action_profile_action_register(ap,
+                       RTE_TABLE_ACTION_DECAP,
+                       NULL);
+
+               if (status) {
+                       rte_table_action_profile_free(ap);
+                       return NULL;
+               }
+       }
+
+       if (params->action_mask & (1LLU << RTE_TABLE_ACTION_SYM_CRYPTO)) {
+               status = rte_table_action_profile_action_register(ap,
+                       RTE_TABLE_ACTION_SYM_CRYPTO,
+                       &params->sym_crypto);
+
+               if (status) {
+                       rte_table_action_profile_free(ap);
+                       return NULL;
+               }
+       }
+
        status = rte_table_action_profile_freeze(ap);
        if (status) {
                rte_table_action_profile_free(ap);