curl: strengthen assertion in curl_clean_state
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 15 May 2017 10:00:53 +0000 (12:00 +0200)
committerJeff Cody <jcody@redhat.com>
Tue, 16 May 2017 14:34:03 +0000 (10:34 -0400)
curl_clean_state should only be called after all AIOCBs have been
completed.  This is not so obvious for the call from curl_detach_aio_context,
so assert that.

Cc: qemu-stable@nongnu.org
Reviewed-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-id: 20170515100059.15795-2-pbonzini@redhat.com
Signed-off-by: Jeff Cody <jcody@redhat.com>
block/curl.c

index 43822348d6cc510e2e270624db6d8c89eb3fa41b..562340f4365181c88b614ebbcda37f82b24bb01e 100644 (file)
@@ -533,6 +533,11 @@ static CURLState *curl_init_state(BlockDriverState *bs, BDRVCURLState *s)
 
 static void curl_clean_state(CURLState *s)
 {
+    int j;
+    for (j = 0; j < CURL_NUM_ACB; j++) {
+        assert(!s->acb[j]);
+    }
+
     if (s->s->multi)
         curl_multi_remove_handle(s->s->multi, s->curl);