QEMU-Devel Archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Konstantin Kostiuk <konstantin@daynix.com>,
	Michael Roth <michael.roth@amd.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
	Developers <qemu-devel@nongnu.org>,
	"Michael Roth" <mdroth@linux.vnet.ibm.com>
Subject: Re: [PATCH-for-6.1 v2] qga-win: Free GMatchInfo properly
Date: Wed, 28 Jul 2021 13:58:59 +0200	[thread overview]
Message-ID: <e25c930d-0f46-e138-80fa-b81967c1aad3@redhat.com> (raw)
In-Reply-To: <CAJ28CFQFxZxsEcy_3zDK1aLRbX0F2ZaMux8KgcE0thLXzm6kkA@mail.gmail.com>

Still candidate for 6.1.

On 7/28/21 9:54 AM, Konstantin Kostiuk wrote:
> ping
> 
> On Wed, Jul 14, 2021 at 10:26 AM Konstantin Kostiuk
> <konstantin@daynix.com <mailto:konstantin@daynix.com>> wrote:
> 
>     CC Michael Roth
> 
>     On Thu, Jun 10, 2021 at 7:14 PM Daniel P. Berrangé
>     <berrange@redhat.com <mailto:berrange@redhat.com>> wrote:
> 
>         On Thu, Jun 10, 2021 at 07:08:36PM +0300, Konstantin Kostiuk wrote:
>         > On Thu, Jun 10, 2021 at 7:02 PM Daniel P. Berrangé
>         <berrange@redhat.com <mailto:berrange@redhat.com>>
>         > wrote:
>         >
>         > > On Thu, Jun 10, 2021 at 06:58:11PM +0300, Kostiantyn Kostiuk
>         wrote:
>         > > > 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
>         <mailto:konstantin@daynix.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 300b87c859..785a5cc6b2 100644
>         > > > --- a/qga/commands-win32.c
>         > > > +++ b/qga/commands-win32.c
>         > > > @@ -2494,7 +2494,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;
>         > >
>         > > This should be initialized to NULL otherwise...
>         > >
>         > > >              GuestDeviceIdPCI *id;
>         > > >              if (!g_regex_match(device_pci_re, hw_ids[j], 0,
>         > > &match_info)) {
>         > > >                  continue;
>         > >
>         > > this continue will trigger freeing of unintialized memory
>         > >
>         >
>         > But we always call match_info, so match_info is always
>         initialized.
>         > The g_regex_match function creates match_info even if it
>         returns FALSE.
> 
>         Opps, yes, you are right.
> 
>         Reviewed-by: Daniel P. Berrangé <berrange@redhat.com
>         <mailto:berrange@redhat.com>>
> 
> 
>         Regards,
>         Daniel
>         -- 
>         |: https://berrange.com <https://berrange.com>      -o-   
>         https://www.flickr.com/photos/dberrange
>         <https://www.flickr.com/photos/dberrange> :|
>         |: https://libvirt.org <https://libvirt.org>         -o-       
>             https://fstop138.berrange.com <https://fstop138.berrange.com> :|
>         |: https://entangle-photo.org <https://entangle-photo.org>   
>         -o-    https://www.instagram.com/dberrange
>         <https://www.instagram.com/dberrange> :|
> 



  reply	other threads:[~2021-07-28 12:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10 15:58 [PATCH v2] qga-win: Free GMatchInfo properly Kostiantyn Kostiuk
2021-06-10 16:02 ` Daniel P. Berrangé
2021-06-10 16:08   ` Konstantin Kostiuk
2021-06-10 16:14     ` Daniel P. Berrangé
2021-07-14  7:26       ` Konstantin Kostiuk
2021-07-28  7:54         ` Konstantin Kostiuk
2021-07-28 11:58           ` Philippe Mathieu-Daudé [this message]
2021-06-10 16:04 ` Philippe Mathieu-Daudé

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=e25c930d-0f46-e138-80fa-b81967c1aad3@redhat.com \
    --to=philmd@redhat.com \
    --cc=berrange@redhat.com \
    --cc=konstantin@daynix.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=michael.roth@amd.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).