New upstream version 16.11.5
[deb_dpdk.git] / lib / librte_eal / common / eal_common_memzone.c
index 1bd0a33..b58d85b 100644 (file)
@@ -236,7 +236,7 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len,
                return NULL;
        }
 
-       const struct malloc_elem *elem = malloc_elem_from_data(mz_addr);
+       struct malloc_elem *elem = malloc_elem_from_data(mz_addr);
 
        /* fill the zone in config */
        mz = get_next_free_memzone();
@@ -244,6 +244,7 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len,
        if (mz == NULL) {
                RTE_LOG(ERR, EAL, "%s(): Cannot find free memzone but there is room "
                                "in config!\n", __func__);
+               malloc_elem_free(elem);
                rte_errno = ENOSPC;
                return NULL;
        }
@@ -337,19 +338,7 @@ rte_memzone_free(const struct rte_memzone *mz)
        idx = ((uintptr_t)mz - (uintptr_t)mcfg->memzone);
        idx = idx / sizeof(struct rte_memzone);
 
-#ifdef RTE_LIBRTE_IVSHMEM
-       /*
-        * If ioremap_addr is set, it's an IVSHMEM memzone and we cannot
-        * free it.
-        */
-       if (mcfg->memzone[idx].ioremap_addr != 0) {
-               rte_rwlock_write_unlock(&mcfg->mlock);
-               return -EINVAL;
-       }
-#endif
-
        addr = mcfg->memzone[idx].addr;
-
        if (addr == NULL)
                ret = -EINVAL;
        else if (mcfg->memzone_cnt == 0) {