summary refs log tree commit diff stats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--block/nbd.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/block/nbd.c b/block/nbd.c
index ed0f93ab27..976be76647 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -1915,6 +1915,7 @@ static int nbd_open(BlockDriverState *bs, QDict *options, int flags,
 
     ret = nbd_client_connect(bs, errp);
     if (ret < 0) {
+        nbd_clear_bdrvstate(s);
         return ret;
     }
     /* successfully connected */