eal/windows: fix out-of-memory check in asprintf
authorDmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Mon, 17 Feb 2020 23:56:16 +0000 (02:56 +0300)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 21 Feb 2020 16:54:56 +0000 (17:54 +0100)
commit6c45dff00aa65080bcfb161fc0f58e44f211cd11
tree1ad87a9075f840126d26a4ca1061035312c63448
parentf872e4d917c34560492424faead2e4ffd7030905
eal/windows: fix out-of-memory check in asprintf

Check vsnprintf() result to prevent calling malloc() with negative size.
Check actual malloc() result and terminate asprintf() with documented
error code to prevent the use of NULL pointer.

Fixes: e8428a9d8 ("eal/windows: add some basic functions and macros")

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Ranjit Menon <ranjit.menon@intel.com>
lib/librte_eal/windows/eal/include/rte_os.h