From: Peter Maydell <peter.maydell@linaro.org>
To: Daniel Henrique Barboza <danielhb413@gmail.com>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, qemu-trivial@nongnu.org
Subject: Re: [PATCH for-8.2 1/2] hw/ppc: use g_free() in spapr_tce_table_post_load()
Date: Sat, 29 Jul 2023 16:26:53 +0100 [thread overview]
Message-ID: <CAFEAcA8MJ8pPwgQMLJZbwVkBLv4BBzLYTGmFw8cOErUo_Z=TOA@mail.gmail.com> (raw)
In-Reply-To: <20230728195646.168997-2-danielhb413@gmail.com>
On Fri, 28 Jul 2023 at 21:15, Daniel Henrique Barboza
<danielhb413@gmail.com> wrote:
>
> tcet->mig_table is memcpy'ed from tcet->table,
The pointer is just copied, not memcpy'd.
> which in turn is created
> via spapr_tce_alloc_table().
You could mention that this uses g_new0() for the allocation.
> Use g_free() instead of free() to deallocate it.
>
> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
> ---
> hw/ppc/spapr_iommu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
> index 63e34d457a..5e3973fc5f 100644
> --- a/hw/ppc/spapr_iommu.c
> +++ b/hw/ppc/spapr_iommu.c
> @@ -248,7 +248,7 @@ static int spapr_tce_table_post_load(void *opaque, int version_id)
> memcpy(tcet->table, tcet->mig_table,
> tcet->nb_table * sizeof(tcet->table[0]));
>
> - free(tcet->mig_table);
> + g_free(tcet->mig_table);
> tcet->mig_table = NULL;
> }
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
next prev parent reply other threads:[~2023-07-29 15:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-28 19:56 [PATCH for-8.2 0/2] ppc: get rid of free() (gitlab #1798) Daniel Henrique Barboza
2023-07-28 19:56 ` [PATCH for-8.2 1/2] hw/ppc: use g_free() in spapr_tce_table_post_load() Daniel Henrique Barboza
2023-07-29 15:26 ` Peter Maydell [this message]
2023-07-28 19:56 ` [PATCH for-8.2 2/2] target/ppc: use g_free() in test_opcode_table() Daniel Henrique Barboza
2023-07-29 15:32 ` Peter Maydell
2023-07-30 17:05 ` Daniel Henrique Barboza
2023-07-29 15:35 ` [PATCH for-8.2 0/2] ppc: get rid of free() (gitlab #1798) Peter Maydell
2023-07-30 17:13 ` Daniel Henrique Barboza
2023-09-07 19:27 ` 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='CAFEAcA8MJ8pPwgQMLJZbwVkBLv4BBzLYTGmFw8cOErUo_Z=TOA@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=danielhb413@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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 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).