qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] qga-win: fix leaks of build_guest_disk_info()


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-devel] [PATCH] qga-win: fix leaks of build_guest_disk_info()
Date: Sun, 4 Nov 2018 23:30:55 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

On 3/11/18 14:01, Marc-André Lureau wrote:
Introduced in commit b1ba8890e63ce9432c41c5c3fc229f54c87c9c99, vol_h
handle should be closed, and "out" cleanup should be done after
DeviceIoControl() fails.

Signed-off-by: Marc-André Lureau <address@hidden>

Reviewed-by: Philippe Mathieu-Daudé <address@hidden>

---
  qga/commands-win32.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index ef1d7d48d2..62e1b51dfe 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -797,7 +797,7 @@ static GuestDiskAddressList *build_guest_disk_info(char 
*guid, Error **errp)
                      0, extents, size, NULL, NULL)) {
                  error_setg_win32(errp, GetLastError(),
                      "failed to get disk extents");
-                return NULL;
+                goto out;
              }
          } else if (last_err == ERROR_INVALID_FUNCTION) {
              /* Possibly CD-ROM or a shared drive. Try to pass the volume */
@@ -855,6 +855,9 @@ static GuestDiskAddressList *build_guest_disk_info(char 
*guid, Error **errp)
out:
+    if (vol_h != INVALID_HANDLE_VALUE) {
+        CloseHandle(vol_h);
+    }
      qapi_free_GuestDiskAddress(disk);
      g_free(extents);
      g_free(name);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]