diff options
author | Klement Sekera <ksekera@cisco.com> | 2018-09-03 12:35:27 +0200 |
---|---|---|
committer | Klement Sekera <ksekera@cisco.com> | 2018-09-03 12:35:27 +0200 |
commit | 7ff0a265a8b5692268c0f44385712c7be8e32775 (patch) | |
tree | 83b8664d739dc22e3f83d141e09126b0a68da042 | |
parent | 732021070fa0c731896ab3e29f802d3834c72ab7 (diff) |
vapi: init clib mem heap on connect if needed
Change-Id: Id45a3a37dd77771289622314406dccf50b64f04d
Signed-off-by: Klement Sekera <ksekera@cisco.com>
-rw-r--r-- | src/vpp-api/vapi/vapi.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/vpp-api/vapi/vapi.c b/src/vpp-api/vapi/vapi.c index 1a0fdbb627a..70382d17bbb 100644 --- a/src/vpp-api/vapi/vapi.c +++ b/src/vpp-api/vapi/vapi.c @@ -306,6 +306,10 @@ vapi_connect (vapi_ctx_t ctx, const char *name, { return VAPI_EINVAL; } + if (!clib_mem_get_per_cpu_heap () && !clib_mem_init (0, 1024 * 1024 * 32)) + { + return VAPI_ENOMEM; + } ctx->requests_size = max_outstanding_requests; const size_t size = ctx->requests_size * sizeof (*ctx->requests); void *tmp = realloc (ctx->requests, size); |