diff options
Diffstat (limited to 'lib/tran_sock.c')
-rw-r--r-- | lib/tran_sock.c | 3 |
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); |