qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Bharata B Rao <bharata@linux.vnet.ibm.com>
Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
	sam.bobroff@au1.ibm.com, rnsastry@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [RFC PATCH v1 1/6] migration: Fix unregister_savevm()
Date: Wed, 17 May 2017 16:43:00 +1000	[thread overview]
Message-ID: <20170517064300.GJ15596@umbus.fritz.box> (raw)
In-Reply-To: <1494992962-6929-2-git-send-email-bharata@linux.vnet.ibm.com>

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

On Wed, May 17, 2017 at 09:19:17AM +0530, Bharata B Rao wrote:
> In unregister_savevm(), free se->compat only if it was allocated earlier.
> 
> Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>

I don't think this is necessary.  If se->compat was never allocated,
then it should be NULL (since se is allocated with g_new0()).
g_free() is explicitly safe to call on NULL, and we already rely on
that in qemu.

> ---
>  migration/savevm.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/migration/savevm.c b/migration/savevm.c
> index 352a8f2..7a268ec 100644
> --- a/migration/savevm.c
> +++ b/migration/savevm.c
> @@ -648,7 +648,9 @@ void unregister_savevm(DeviceState *dev, const char *idstr, void *opaque)
>      QTAILQ_FOREACH_SAFE(se, &savevm_state.handlers, entry, new_se) {
>          if (strcmp(se->idstr, id) == 0 && se->opaque == opaque) {
>              QTAILQ_REMOVE(&savevm_state.handlers, se, entry);
> -            g_free(se->compat);
> +            if (dev) {
> +                g_free(se->compat);
> +            }
>              g_free(se->ops);
>              g_free(se);
>          }

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2017-05-17  7:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-17  3:49 [Qemu-devel] [RFC PATCH v1 0/6] ppc/spapr: Fix migration of radix guests Bharata B Rao
2017-05-17  3:49 ` [Qemu-devel] [RFC PATCH v1 1/6] migration: Fix unregister_savevm() Bharata B Rao
2017-05-17  6:43   ` David Gibson [this message]
2017-05-17 10:12     ` Bharata B Rao
2017-05-17  3:49 ` [Qemu-devel] [RFC PATCH v1 2/6] migration: Introduce unregister_savevm_live() Bharata B Rao
2017-05-17  6:45   ` David Gibson
2017-05-17  7:21     ` Bharata B Rao
2017-05-17  3:49 ` [Qemu-devel] [RFC PATCH v1 3/6] spapr: Make h_register_process_table hcall flags global Bharata B Rao
2017-05-17  3:49 ` [Qemu-devel] [RFC PATCH v1 4/6] spapr: Consolidate HPT freeing code into a routine Bharata B Rao
2017-05-17  6:55   ` David Gibson
2017-05-17  3:49 ` [Qemu-devel] [RFC PATCH v1 5/6] spapr: Unregister HPT savevm handlers for radix guests Bharata B Rao
2017-05-17  6:59   ` David Gibson
2017-05-17  7:18     ` Bharata B Rao
2017-05-17  7:23       ` David Gibson
2017-05-17  3:49 ` [Qemu-devel] [RFC PATCH v1 6/6] spapr: Fix migration of Radix guests Bharata B Rao
2017-05-17  7:00   ` David Gibson
2017-05-17  7:15     ` Bharata B Rao
2017-05-17  7:20       ` David Gibson
2017-05-18  5:03         ` Bharata B Rao
2017-05-18  5:50           ` David Gibson

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=20170517064300.GJ15596@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rnsastry@linux.vnet.ibm.com \
    --cc=sam.bobroff@au1.ibm.com \
    /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).