X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_lpm%2Frte_lpm6.c;h=32fdba01e8d532bf4007a41aac2e2adc55a22a0f;hb=7f74b95c444f;hp=eded7725e800358716cc525db079755bd1d5c3a0;hpb=732a5b5c53c9ac46e90d782175dd7fcd033288cc;p=dpdk.git diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c index eded7725e8..32fdba01e8 100644 --- a/lib/librte_lpm/rte_lpm6.c +++ b/lib/librte_lpm/rte_lpm6.c @@ -182,8 +182,11 @@ rte_lpm6_create(const char *name, int socket_id, if (strncmp(name, lpm->name, RTE_LPM6_NAMESIZE) == 0) break; } - if (te != NULL) + lpm = NULL; + if (te != NULL) { + rte_errno = EEXIST; goto exit; + } /* allocate tailq entry */ te = rte_zmalloc("LPM6_TAILQ_ENTRY", sizeof(*te), 0); @@ -206,8 +209,9 @@ rte_lpm6_create(const char *name, int socket_id, (size_t)rules_size, RTE_CACHE_LINE_SIZE, socket_id); if (lpm->rules_tbl == NULL) { - RTE_LOG(ERR, LPM, "LPM memory allocation failed\n"); + RTE_LOG(ERR, LPM, "LPM rules_tbl allocation failed\n"); rte_free(lpm); + lpm = NULL; rte_free(te); goto exit; } @@ -597,7 +601,7 @@ int rte_lpm6_lookup(const struct rte_lpm6 *lpm, uint8_t *ip, uint8_t *next_hop) { const struct rte_lpm6_tbl_entry *tbl; - const struct rte_lpm6_tbl_entry *tbl_next; + const struct rte_lpm6_tbl_entry *tbl_next = NULL; int status; uint8_t first_byte; uint32_t tbl24_index; @@ -632,7 +636,7 @@ rte_lpm6_lookup_bulk_func(const struct rte_lpm6 *lpm, { unsigned i; const struct rte_lpm6_tbl_entry *tbl; - const struct rte_lpm6_tbl_entry *tbl_next; + const struct rte_lpm6_tbl_entry *tbl_next = NULL; uint32_t tbl24_index; uint8_t first_byte, next_hop; int status;