diff options
-rw-r--r-- | src/scvpp/inc/scvpp/comm.h | 5 | ||||
-rw-r--r-- | src/scvpp/src/comm.c | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/scvpp/inc/scvpp/comm.h b/src/scvpp/inc/scvpp/comm.h index da83fa7..ed02d5d 100644 --- a/src/scvpp/inc/scvpp/comm.h +++ b/src/scvpp/inc/scvpp/comm.h @@ -137,8 +137,11 @@ static inline int push(struct elt **stack, void *data, int length) if (!el) return -ENOMEM; el->data = malloc(length); - if (!el->data) + if (!el->data) { + free(el); return -ENOMEM; + } + memcpy(el->data, data, length); if (*stack) diff --git a/src/scvpp/src/comm.c b/src/scvpp/src/comm.c index 532ee1e..b679880 100644 --- a/src/scvpp/src/comm.c +++ b/src/scvpp/src/comm.c @@ -32,6 +32,10 @@ int sc_connect_vpp() if (g_vapi_ctx == NULL) { vapi_error_e rv = vapi_ctx_alloc(&g_vapi_ctx); + if (rv != VAPI_OK) { + g_vapi_ctx = NULL; + return -1; + } rv = vapi_connect(g_vapi_ctx, APP_NAME, NULL, MAX_OUTSTANDING_REQUESTS, RESPONSE_QUEUE_SIZE, VAPI_MODE_BLOCKING, true); |