All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Roth <michael.roth@amd.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org,
	"Kostiantyn Kostiuk" <konstantin@daynix.com>,
	"Daniel P . Berrangé" <berrange@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [PULL for-6.1 4/6] qga-win: Free GMatchInfo properly
Date: Tue,  3 Aug 2021 08:24:50 -0500	[thread overview]
Message-ID: <20210803132450.1093602-5-michael.roth@amd.com> (raw)
In-Reply-To: <20210803132450.1093602-1-michael.roth@amd.com>

From: Kostiantyn Kostiuk <konstantin@daynix.com>

The g_regex_match function creates match_info even if it
returns FALSE. So we should always call g_match_info_free.
A better solution is using g_autoptr for match_info variable.

Signed-off-by: Kostiantyn Kostiuk <konstantin@daynix.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 qga/commands-win32.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 098211e724..7bac0c5d42 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -2459,7 +2459,7 @@ GuestDeviceInfoList *qmp_guest_get_devices(Error **errp)
             continue;
         }
         for (j = 0; hw_ids[j] != NULL; j++) {
-            GMatchInfo *match_info;
+            g_autoptr(GMatchInfo) match_info;
             GuestDeviceIdPCI *id;
             if (!g_regex_match(device_pci_re, hw_ids[j], 0, &match_info)) {
                 continue;
@@ -2476,7 +2476,6 @@ GuestDeviceInfoList *qmp_guest_get_devices(Error **errp)
             id->vendor_id = g_ascii_strtoull(vendor_id, NULL, 16);
             id->device_id = g_ascii_strtoull(device_id, NULL, 16);
 
-            g_match_info_free(match_info);
             break;
         }
         if (skip) {
-- 
2.25.1



  parent reply	other threads:[~2021-08-03 13:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-03 13:24 [PULL for-6.1 0/6] qemu-ga patch queue for hard-freeze Michael Roth
2021-08-03 13:24 ` [PULL for-6.1 1/6] qga-win: Increase VSS freeze timeout to 60 secs instead of 10 Michael Roth
2021-08-03 13:24 ` [PULL for-6.1 2/6] qga-win: Fix build_guest_fsinfo() close of nonexistent Michael Roth
2021-08-03 13:24 ` [PULL for-6.1 3/6] qga-win: Fix handle leak in ga_get_win_product_name() Michael Roth
2021-08-03 13:24 ` Michael Roth [this message]
2021-08-03 13:24 ` [PULL for-6.1 5/6] qemu-ga/msi: fix w32 libgcc name Michael Roth
2021-08-03 13:24 ` [PULL for-6.1 6/6] qga-win/msi: fix missing libstdc++-6 DLL in MSI installer Michael Roth
2021-08-03 16:49 ` [PULL for-6.1 0/6] qemu-ga patch queue for hard-freeze Peter Maydell

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=20210803132450.1093602-5-michael.roth@amd.com \
    --to=michael.roth@amd.com \
    --cc=berrange@redhat.com \
    --cc=konstantin@daynix.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@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.