qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Ján Tomko" <jtomko@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: qemu-devel@nongnu.org,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	Juan Quintela <quintela@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] migration: use g_free for ram load bitmap
Date: Sun, 27 May 2018 11:15:42 +0200	[thread overview]
Message-ID: <20180527091542.GC22274@dnr> (raw)
In-Reply-To: <20180525015042.31778-1-peterx@redhat.com>

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

On Fri, May 25, 2018 at 09:50:42AM +0800, Peter Xu wrote:
>Buffers allocated with bitmap_new() should be freed with g_free().
>
>Both reported by Coverity:
>
>*** CID 1391300:  API usage errors  (ALLOC_FREE_MISMATCH)
>/migration/ram.c: 3517 in ram_dirty_bitmap_reload()
>3511          * the last one to sync, we need to notify the main send thread.
>3512          */
>3513         ram_dirty_bitmap_reload_notify(s);
>3514
>3515         ret = 0;
>3516     out:
>>>>     CID 1391300:  API usage errors  (ALLOC_FREE_MISMATCH)
>>>>     Calling "free" frees "le_bitmap" using "free" but it should have been freed using "g_free".
>3517         free(le_bitmap);
>3518         return ret;
>3519     }
>3520
>3521     static int ram_resume_prepare(MigrationState *s, void *opaque)
>3522     {
>
>*** CID 1391292:  API usage errors  (ALLOC_FREE_MISMATCH)
>/migration/ram.c: 249 in ramblock_recv_bitmap_send()
>243          * Mark as an end, in case the middle part is screwed up due to
>244          * some "misterious" reason.
>245          */
>246         qemu_put_be64(file, RAMBLOCK_RECV_BITMAP_ENDING);
>247         qemu_fflush(file);
>248
>>>>     CID 1391292:  API usage errors  (ALLOC_FREE_MISMATCH)
>>>>     Calling "free" frees "le_bitmap" using "free" but it should have been freed using "g_free".
>249         free(le_bitmap);
>250
>251         if (qemu_file_get_error(file)) {
>252             return qemu_file_get_error(file);
>253         }
>254
>
>Signed-off-by: Peter Xu <peterx@redhat.com>
>---
> migration/ram.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      parent reply	other threads:[~2018-05-27  9:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-25  1:50 [Qemu-devel] [PATCH] migration: use g_free for ram load bitmap Peter Xu
2018-05-25  9:16 ` Juan Quintela
2018-05-27  9:15 ` Ján Tomko [this message]

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=20180527091542.GC22274@dnr \
    --to=jtomko@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.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).