qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PULL 32/32] qapi: Add missing null check to opts_start_str


From: Luiz Capitulino
Subject: [Qemu-devel] [PULL 32/32] qapi: Add missing null check to opts_start_struct()
Date: Mon, 3 Mar 2014 12:12:23 -0500

From: Markus Armbruster <address@hidden>

Argument is null when visiting an unboxed struct.  I can't see such a
visit in the current code.  Fix it anyway.

Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>
---
 qapi/opts-visitor.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c
index 96ed858..5d830a2 100644
--- a/qapi/opts-visitor.c
+++ b/qapi/opts-visitor.c
@@ -124,7 +124,9 @@ opts_start_struct(Visitor *v, void **obj, const char *kind,
     OptsVisitor *ov = DO_UPCAST(OptsVisitor, visitor, v);
     const QemuOpt *opt;
 
-    *obj = g_malloc0(size > 0 ? size : 1);
+    if (obj) {
+        *obj = g_malloc0(size > 0 ? size : 1);
+    }
     if (ov->depth++ > 0) {
         return;
     }
-- 
1.8.1.4




reply via email to

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