]> xenbits.xensource.com Git - qemu-upstream-4.5-testing.git/commitdiff
win32-aio: Fix memory leak
authorKevin Wolf <kwolf@redhat.com>
Wed, 16 Jan 2013 20:20:00 +0000 (21:20 +0100)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 21 Jan 2013 19:43:10 +0000 (13:43 -0600)
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>
(cherry picked from commit e8bccad5ac6095b5af7946cd72d9aacb57f7c0a3)

Conflicts:

block/win32-aio.c

*addressed conflict due to buggy g_free() still in use instead of
qemu_vfree() as it is upstream (via commit 7479acdb)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
block/win32-aio.c

index 6b0270725420b23ea78f17fb3c95643291f165c1..9b79633e6e30cd358f6eefbc552f2e3ff34a87f8 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;
             }
-            g_free(waiocb->buf);
         }
+        qemu_vfree(waiocb->buf);
     }