aboutsummaryrefslogtreecommitdiff
path: root/lib/tran_sock.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tran_sock.c')
-rw-r--r--lib/tran_sock.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/tran_sock.c b/lib/tran_sock.c
index 51a8566..87072d6 100644
--- a/lib/tran_sock.c
+++ b/lib/tran_sock.c
@@ -848,11 +848,10 @@ tran_sock_detach(vfu_ctx_t *vfu_ctx)
tran_sock_t *ts;
assert(vfu_ctx != NULL);
- assert(vfu_ctx->tran_data != NULL);
ts = vfu_ctx->tran_data;
- if (ts->conn_fd != -1) {
+ if (ts != NULL && ts->conn_fd != -1) {
// FIXME: handle EINTR
(void) close(ts->conn_fd);
ts->conn_fd = -1;
@@ -865,11 +864,10 @@ tran_sock_fini(vfu_ctx_t *vfu_ctx)
tran_sock_t *ts;
assert(vfu_ctx != NULL);
- assert(vfu_ctx->tran_data != NULL);
ts = vfu_ctx->tran_data;
- if (ts->listen_fd != -1) {
+ if (ts != NULL && ts->listen_fd != -1) {
// FIXME: handle EINTR
(void) close(ts->listen_fd);
ts->listen_fd = -1;