diff mbox series

[v2,20/22] qom/object: fix -Werror=maybe-uninitialized

Message ID 20240924130554.749278-21-marcandre.lureau@redhat.com (mailing list archive)
State New, archived
Headers show
Series -Werror=maybe-uninitialized fixes | expand

Commit Message

Marc-André Lureau Sept. 24, 2024, 1:05 p.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

object_resolve_path_type() didn't always set *ambiguousp.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 qom/object.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/qom/object.c b/qom/object.c
index 157a45c5f8..b2120f7dc5 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -2202,6 +2202,9 @@  Object *object_resolve_path_type(const char *path, const char *typename,
         }
     } else {
         obj = object_resolve_abs_path(object_get_root(), parts + 1, typename);
+        if (ambiguousp) {
+            *ambiguousp = false;
+        }
     }
 
     g_strfreev(parts);
@@ -2227,7 +2230,7 @@  Object *object_resolve_path_at(Object *parent, const char *path)
 
 Object *object_resolve_type_unambiguous(const char *typename, Error **errp)
 {
-    bool ambig;
+    bool ambig = false;
     Object *o = object_resolve_path_type("", typename, &ambig);
 
     if (ambig) {