[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] nvdimm acpi: fix g_array_free() with NULL point

From: Xiao Guangrong
Subject: Re: [Qemu-devel] [PATCH] nvdimm acpi: fix g_array_free() with NULL pointer
Date: Thu, 12 Jan 2017 11:18:25 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0

On 01/11/2017 05:36 PM, Stefan Hajnoczi wrote:
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 <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
 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);
+    }

Er, i do not know why it is NULL as we have init-ed it in 

static void nvdimm_init_fit_buffer(NvdimmFitBuffer *fit_buf)
    fit_buf->fit = g_array_new(false, true /* clear */, 1);

And i can not reproduce it on my box, could you share your command line and the
based commit id?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]