]> git.proxmox.com Git - mirror_qemu.git/blobdiff - qom/object.c
9pfs: refactor 'name_idx' -> 'nwalked' in v9fs_walk()
[mirror_qemu.git] / qom / object.c
index 4048a2fef1eb48d24f775ef88e7ce8cb32d71703..d34608558e9e5e53f4b363774f06b810f49ca36c 100644 (file)
@@ -1168,10 +1168,14 @@ GSList *object_class_get_list_sorted(const char *implements_type,
 Object *object_ref(void *objptr)
 {
     Object *obj = OBJECT(objptr);
+    uint32_t ref;
+
     if (!obj) {
         return NULL;
     }
-    qatomic_inc(&obj->ref);
+    ref = qatomic_fetch_inc(&obj->ref);
+    /* Assert waaay before the integer overflows */
+    g_assert(ref < INT_MAX);
     return obj;
 }