malloc: fix memory element size in case of padding

This patch fixes wrong inner memory element size when joining two
elements.

Fixes: af75078fec ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
This commit is contained in:
Xueming Li 2019-11-21 14:25:02 +00:00 committed by Thomas Monjalon
parent 694fd2cb8d
commit 2808a12cc0

View File

@ -487,6 +487,10 @@ join_elem(struct malloc_elem *elem1, struct malloc_elem *elem2)
else else
elem1->heap->last = elem1; elem1->heap->last = elem1;
elem1->next = next; elem1->next = next;
if (elem1->pad) {
struct malloc_elem *inner = RTE_PTR_ADD(elem1, elem1->pad);
inner->size = elem1->size - elem1->pad;
}
} }
struct malloc_elem * struct malloc_elem *