malloc: check for heap corruption
authorAnatoly Burakov <anatoly.burakov@intel.com>
Mon, 16 Apr 2018 15:04:27 +0000 (16:04 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 27 Apr 2018 21:52:51 +0000 (23:52 +0200)
commit64b6fcb1610814c68b3f6fe57f59732b98502aa3
tree154fa19fedae2f05539f3fe17e23693d34f5c52a
parent0af8db317267544e86b271008360d9847973f92c
malloc: check for heap corruption

Previous code checked for both first/last elements being NULL,
but if they weren't, the expectation was that they're both
non-NULL, which will be the case under normal conditions, but
may not be the case due to heap structure corruption.

Coverity issue: 272566
Fixes: bb372060dad4 ("malloc: make heap a doubly-linked list")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
lib/librte_eal/common/malloc_elem.c