summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--block/nbd.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/block/nbd.c b/block/nbd.c
index 81edabbf35..57c1a20581 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -640,12 +640,11 @@ static coroutine_fn int nbd_co_receive_one_chunk(
                                           request_ret, qiov, payload, errp);
 
     if (ret < 0) {
+        memset(reply, 0, sizeof(*reply));
         s->quit = true;
     } else {
         /* For assert at loop start in nbd_connection_entry */
-        if (reply) {
-            *reply = s->reply;
-        }
+        *reply = s->reply;
         s->reply.handle = 0;
     }