Patchwork [2/2] win32-aio: Fix memory leak

login
register
mail settings
Submitter Kevin Wolf
Date Jan. 16, 2013, 8:20 p.m.
Message ID <1358367600-8074-3-git-send-email-kwolf@redhat.com>
Download mbox | patch
Permalink /patch/213056/
State New
Headers show

Comments

Kevin Wolf - Jan. 16, 2013, 8:20 p.m.
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>
---
 block/win32-aio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/block/win32-aio.c b/block/win32-aio.c
index 53b82e6..546a60d 100644
--- a/block/win32-aio.c
+++ b/block/win32-aio.c
@@ -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);
         }
+        g_free(waiocb->buf);
     }