Check that passed pool is not ODP_POOL_INVALID before goint to try to
allocate buffers from that pool.

Signed-off-by: Dmitry Eremin-Solenikov <[email protected]>
---
 platform/linux-generic/odp_pool.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/platform/linux-generic/odp_pool.c 
b/platform/linux-generic/odp_pool.c
index cf7c2c41..f0b64932 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -768,6 +768,9 @@ odp_buffer_t odp_buffer_alloc(odp_pool_t pool_hdl)
        pool_t *pool;
        int ret;
 
+       if (ODP_POOL_INVALID == pool_hdl)
+               return ODP_BUFFER_INVALID;
+
        pool = pool_entry_from_hdl(pool_hdl);
        ret = buffer_alloc_multi(pool, &buf, NULL, 1);
 
-- 
2.11.0

Reply via email to