From 5590ea8eb54e9f653b55b70f95e0793898e1955c Mon Sep 17 00:00:00 2001 From: John Levon Date: Wed, 20 Oct 2021 13:47:30 +0100 Subject: fix coverity warnings (#611) Fix a few coverity-identified issues. Signed-off-by: John Levon Reviewed-by: Swapnil Ingle --- lib/tran_sock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/tran_sock.c') diff --git a/lib/tran_sock.c b/lib/tran_sock.c index f8b7004..fb2dab7 100644 --- a/lib/tran_sock.c +++ b/lib/tran_sock.c @@ -419,6 +419,7 @@ tran_sock_init(vfu_ctx_t *vfu_ctx) ret = snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", vfu_ctx->uuid); if (ret >= (int)sizeof(addr.sun_path)) { ret = ENAMETOOLONG; + goto out; } else if (ret < 0) { ret = EINVAL; goto out; @@ -438,7 +439,7 @@ tran_sock_init(vfu_ctx_t *vfu_ctx) out: if (ret != 0) { - if (ts->listen_fd != -1) { + if (ts != NULL && ts->listen_fd != -1) { close(ts->listen_fd); } free(ts); -- cgit v1.1