vhost: pre update used ring for Tx and Rx
[dpdk.git] / lib / librte_lpm / rte_lpm.c
index bd3563f..6f65d1c 100644 (file)
@@ -209,8 +209,11 @@ rte_lpm_create_v20(const char *name, int socket_id, int max_rules,
                if (strncmp(name, lpm->name, RTE_LPM_NAMESIZE) == 0)
                        break;
        }
-       if (te != NULL)
+       lpm = NULL;
+       if (te != NULL) {
+               rte_errno = EEXIST;
                goto exit;
+       }
 
        /* allocate tailq entry */
        te = rte_zmalloc("LPM_TAILQ_ENTRY", sizeof(*te), 0);
@@ -280,8 +283,11 @@ rte_lpm_create_v1604(const char *name, int socket_id,
                if (strncmp(name, lpm->name, RTE_LPM_NAMESIZE) == 0)
                        break;
        }
-       if (te != NULL)
+       lpm = NULL;
+       if (te != NULL) {
+               rte_errno = EEXIST;
                goto exit;
+       }
 
        /* allocate tailq entry */
        te = rte_zmalloc("LPM_TAILQ_ENTRY", sizeof(*te), 0);
@@ -367,7 +373,6 @@ rte_lpm_free_v20(struct rte_lpm_v20 *lpm)
 
        rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);
 
-       rte_free(lpm->rules_tbl);
        rte_free(lpm);
        rte_free(te);
 }