qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Yong Huang <yong.huang@smartx.com>
To: alloc.young@outlook.com
Cc: mjt@tls.msk.ru, qemu-devel@nongnu.org
Subject: Re: [PATCH v2 2/2] softmmu/dirtylimit: Convert free to g_free
Date: Fri, 25 Aug 2023 10:42:37 +0800	[thread overview]
Message-ID: <CAK9dgmbsn2SpvT+uOUhbPFOUbNLzPvsf09+Qkwziz9JZw2Q=XQ@mail.gmail.com> (raw)
In-Reply-To: <SA1PR11MB67604ECD85AFF34BEB3072F7F5E3A@SA1PR11MB6760.namprd11.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 1612 bytes --]

On Fri, Aug 25, 2023 at 10:33 AM <alloc.young@outlook.com> wrote:

> From: alloc <alloc.young@outlook.com>
>
> Convert free to g_free to match g_new and g_malloc functions.
>
> Signed-off-by: alloc <alloc.young@outlook.com>
> ---
>  softmmu/dirtylimit.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/softmmu/dirtylimit.c b/softmmu/dirtylimit.c
> index e3ff53b8fc..fa959d7743 100644
> --- a/softmmu/dirtylimit.c
> +++ b/softmmu/dirtylimit.c
> @@ -100,7 +100,7 @@ static void vcpu_dirty_rate_stat_collect(void)
>              stat.rates[i].dirty_rate;
>      }
>
> -    free(stat.rates);
> +    g_free(stat.rates);
>  }
>
>  static void *vcpu_dirty_rate_stat_thread(void *opaque)
> @@ -171,10 +171,10 @@ void vcpu_dirty_rate_stat_initialize(void)
>
>  void vcpu_dirty_rate_stat_finalize(void)
>  {
> -    free(vcpu_dirty_rate_stat->stat.rates);
> +    g_free(vcpu_dirty_rate_stat->stat.rates);
>      vcpu_dirty_rate_stat->stat.rates = NULL;
>
> -    free(vcpu_dirty_rate_stat);
> +    g_free(vcpu_dirty_rate_stat);
>      vcpu_dirty_rate_stat = NULL;
>  }
>
> @@ -220,10 +220,10 @@ void dirtylimit_state_initialize(void)
>
>  void dirtylimit_state_finalize(void)
>  {
> -    free(dirtylimit_state->states);
> +    g_free(dirtylimit_state->states);
>      dirtylimit_state->states = NULL;
>
> -    free(dirtylimit_state);
> +    g_free(dirtylimit_state);
>      dirtylimit_state = NULL;
>
>      trace_dirtylimit_state_finalize();
> --
> 2.39.3
>
>
Reviewed-by: Hyman Huang <yong.huang@smartx.com>

-- 
Best regards

[-- Attachment #2: Type: text/html, Size: 3051 bytes --]

  reply	other threads:[~2023-08-25  2:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-25  2:29 [PATCH v2 0/2] softmmu/dirtylimit: Fix memory leak issue alloc.young
2023-08-25  2:31 ` [PATCH v2 1/2] softmmu: Fix dirtylimit memory leak alloc.young
2023-08-25  2:32 ` [PATCH v2 2/2] softmmu/dirtylimit: Convert free to g_free alloc.young
2023-08-25  2:42   ` Yong Huang [this message]
2023-08-25  7:26   ` 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='CAK9dgmbsn2SpvT+uOUhbPFOUbNLzPvsf09+Qkwziz9JZw2Q=XQ@mail.gmail.com' \
    --to=yong.huang@smartx.com \
    --cc=alloc.young@outlook.com \
    --cc=mjt@tls.msk.ru \
    --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 NNTP newsgroup(s).