win32-aio: Fix memory leak
authorKevin Wolf <kwolf@redhat.com>
Wed, 16 Jan 2013 20:20:00 +0000 (21:20 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Thu, 17 Jan 2013 09:58:09 +0000 (10:58 +0100)
The buffer is allocated for both reads and writes, and obviously it
should be freed even if an error occurs.

Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block/win32-aio.c

index e4b7b75..b9236ea 100644 (file)
@@ -87,8 +87,8 @@ static void win32_aio_process_completion(QEMUWin32AIOState *s,
                 memcpy(qiov->iov[i].iov_base, p, qiov->iov[i].iov_len);
                 p += qiov->iov[i].iov_len;
             }
-            qemu_vfree(waiocb->buf);
         }
+        qemu_vfree(waiocb->buf);
     }