qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] nvdimm acpi: fix g_array_free() with NULL pointer
@ 2017-01-11  9:44 Stefan Hajnoczi
  2017-01-11 16:08 ` Igor Mammedov
  2017-01-12 10:58 ` Stefan Hajnoczi
  0 siblings, 2 replies; 7+ messages in thread
From: Stefan Hajnoczi @ 2017-01-11  9:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: imammedo, Michael S. Tsirkin, Stefan Hajnoczi, Xiao Guangrong

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH] nvdimm acpi: fix g_array_free() with NULL pointer
@ 2017-01-11  9:36 Stefan Hajnoczi
  2017-01-12  3:18 ` Xiao Guangrong
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Hajnoczi @ 2017-01-11  9:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: imammedo, Michael S. Tsirkin, Stefan Hajnoczi, Xiao Guangrong

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-01-13  0:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-11  9:44 [Qemu-devel] [PATCH] nvdimm acpi: fix g_array_free() with NULL pointer Stefan Hajnoczi
2017-01-11 16:08 ` 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

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).