qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: imammedo@redhat.com, "Michael S. Tsirkin" <mst@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Xiao Guangrong <guangrong.xiao@linux.intel.com>
Subject: [Qemu-devel] [PATCH] nvdimm acpi: fix g_array_free() with NULL pointer
Date: Wed, 11 Jan 2017 09:44:43 +0000	[thread overview]
Message-ID: <20170111094443.2790-1-stefanha@redhat.com> (raw)

Unlike g_free(), g_array_free() does not accept a NULL pointer argument.
The following error is logged when an nvdimm device is realized:

  GLib-CRITICAL **: g_array_free: assertion 'array' failed

Cc: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 hw/acpi/nvdimm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c
index 8e7d6ec..8f0a484 100644
--- a/hw/acpi/nvdimm.c
+++ b/hw/acpi/nvdimm.c
@@ -375,7 +375,9 @@ static void nvdimm_init_fit_buffer(NvdimmFitBuffer *fit_buf)
 
 static void nvdimm_build_fit_buffer(NvdimmFitBuffer *fit_buf)
 {
-    g_array_free(fit_buf->fit, true);
+    if (fit_buf->fit) {
+        g_array_free(fit_buf->fit, true);
+    }
     fit_buf->fit = nvdimm_build_device_structure();
     fit_buf->dirty = true;
 }
-- 
2.9.3

             reply	other threads:[~2017-01-11  9:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-11  9:44 Stefan Hajnoczi [this message]
2017-01-11 16:08 ` [Qemu-devel] [PATCH] nvdimm acpi: fix g_array_free() with NULL pointer Igor Mammedov
2017-01-12 10:58 ` Stefan Hajnoczi
  -- strict thread matches above, loose matches on Subject: below --
2017-01-11  9:36 Stefan Hajnoczi
2017-01-12  3:18 ` Xiao Guangrong
2017-01-12 11:09   ` Stefan Hajnoczi
2017-01-13  0:50     ` Xiao Guangrong

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=20170111094443.2790-1-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=guangrong.xiao@linux.intel.com \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.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 NNTP newsgroup(s).