All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: qemu-devel@nongnu.org
Cc: Li Ping <li.ping288@zte.com.cn>,
	qemu-trivial@nongnu.org, Michael Tokarev <mjt@tls.msk.ru>
Subject: [Qemu-devel] [PULL 09/13] qga-win32: Fix memory leak of device information set
Date: Wed, 12 Jul 2017 16:38:05 +0300	[thread overview]
Message-ID: <9bd8e9330ade42878b19a5172131087220d590d5.1499866676.git.mjt@msgid.tls.msk.ru> (raw)
In-Reply-To: <cover.1499866676.git.mjt@msgid.tls.msk.ru>
In-Reply-To: <cover.1499866676.git.mjt@msgid.tls.msk.ru>

From: Li Ping <li.ping288@zte.com.cn>

The caller of SetupDiGetClassDevs must delete the returned device information
 set when it is no longer needed by calling SetupDiDestroyDeviceInfoList.

Signed-off-by: Li Ping <li.ping288@zte.com.cn>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 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 439d229225..6f1645747b 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -512,7 +512,7 @@ static GuestPCIAddress *get_pci_info(char *guid, Error **errp)
             } else {
                 error_setg_win32(errp, GetLastError(),
                         "failed to get device name");
-                goto out;
+                goto free_dev_info;
             }
         }
 
@@ -560,6 +560,9 @@ static GuestPCIAddress *get_pci_info(char *guid, Error **errp)
         pci->bus = bus;
         break;
     }
+
+free_dev_info:
+    SetupDiDestroyDeviceInfoList(dev_info);
 out:
     g_free(buffer);
     g_free(name);
-- 
2.11.0

  parent reply	other threads:[~2017-07-12 13:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-12 13:37 [Qemu-devel] [PULL 00/13] Trivial patches for 2017-07-12 Michael Tokarev
2017-07-12 13:37 ` [Qemu-devel] [PULL 01/13] target/xtensa: gdbstub: drop dead return statement Michael Tokarev
2017-07-12 13:37 ` [Qemu-devel] [PULL 02/13] util/qemu-sockets: Drop unused helper socket_address_to_string() Michael Tokarev
2017-07-12 13:37 ` [Qemu-devel] [PULL 03/13] configure: Fix build with pkg-config and --static --enable-sdl Michael Tokarev
2017-07-12 13:38 ` [Qemu-devel] [PULL 04/13] hw/misc: add missing includes Michael Tokarev
2017-07-12 13:38 ` [Qemu-devel] [PULL 05/13] hw/pci: define msi_nonbroken in pci-stub Michael Tokarev
2017-07-12 13:38 ` [Qemu-devel] [PULL 06/13] configure: Handle having no c++ compiler in FORTIFY_SOURCE check Michael Tokarev
2017-07-12 13:38 ` [Qemu-devel] [PULL 07/13] elf-loader: warn about invalid endianness Michael Tokarev
2017-07-12 13:38 ` [Qemu-devel] [PULL 08/13] hw/core: fix missing return value in load_image_targphys_as() Michael Tokarev
2017-07-12 13:38 ` Michael Tokarev [this message]
2017-07-12 13:38 ` [Qemu-devel] [PULL 10/13] hxtool: remove dead -q option Michael Tokarev
2017-07-12 13:38 ` [Qemu-devel] [PULL 11/13] include/hw/ptimer.h: Add documentation comments Michael Tokarev
2017-07-12 13:38 ` [Qemu-devel] [PULL 12/13] qobject: Catch another straggler for use of qdict_put_str() Michael Tokarev
2017-07-12 13:38 ` [Qemu-devel] [PULL 13/13] qobject: Update coccinelle script to catch Q{INC, DEC}REF Michael Tokarev
2017-07-12 13:57 ` [Qemu-devel] [PULL 00/13] Trivial patches for 2017-07-12 Eric Blake
2017-07-12 14:02   ` Michael Tokarev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9bd8e9330ade42878b19a5172131087220d590d5.1499866676.git.mjt@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=li.ping288@zte.com.cn \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.