aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2021-10-20 13:47:30 +0100
committerGitHub <noreply@github.com>2021-10-20 13:47:30 +0100
commit5590ea8eb54e9f653b55b70f95e0793898e1955c (patch)
tree04cb65c30d23972b6f64ae9f38496286f89a79f1 /lib
parent8d82bd5f20fac5d8b4dab510d2294e076a6dd93d (diff)
downloadlibvfio-user-5590ea8eb54e9f653b55b70f95e0793898e1955c.zip
libvfio-user-5590ea8eb54e9f653b55b70f95e0793898e1955c.tar.gz
libvfio-user-5590ea8eb54e9f653b55b70f95e0793898e1955c.tar.bz2
fix coverity warnings (#611)
Fix a few coverity-identified issues. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/tran_sock.c3
1 files changed, 2 insertions, 1 deletions
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);