New upstream version 17.11.1
[deb_dpdk.git] / lib / librte_eal / common / eal_common_memzone.c
index ea072a2..b682b00 100644 (file)
@@ -237,7 +237,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();
@@ -245,6 +245,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;
        }