summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--chardev/char.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/chardev/char.c b/chardev/char.c
index e5b43cb4b8..a0626d04d5 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -996,7 +996,11 @@ static Chardev *chardev_new(const char *id, const char *typename,
     }
 
     if (id) {
-        object_property_add_child(get_chardevs_root(), id, obj);
+        object_property_try_add_child(get_chardevs_root(), id, obj,
+                                      &local_err);
+        if (local_err) {
+            goto end;
+        }
         object_unref(obj);
     }