]> git.droids-corp.org - dpdk.git/blobdiff - lib/librte_hash/rte_cuckoo_hash.c
hash: fix allocation of an existing object
[dpdk.git] / lib / librte_hash / rte_cuckoo_hash.c
index 04e95b7323a2242436698ed60480537463dfec37..b00cc124282d0f5f204288f7a6eb77353fed059e 100644 (file)
@@ -299,8 +299,10 @@ rte_hash_create(const struct rte_hash_parameters *params)
 
        /* Guarantee there's no existing */
        h = rte_hash_find_existing(params->name);
-       if (h != NULL)
-               return h;
+       if (h != NULL) {
+               rte_errno = EEXIST;
+               return NULL;
+       }
 
        te = rte_zmalloc("HASH_TAILQ_ENTRY", sizeof(*te), 0);
        if (te == NULL) {