qemu: qapi: Return correct entry in virQEMUQAPISchemaTraverse

virQEMUQAPISchemaTraverse would return previous-to-last queried item on
a query. It would not be a problem if checking if the given path exists
since error reporting works properly but if the caller is interested in
the result, it would be wrong.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Peter Krempa 2018-03-21 16:51:29 +01:00
parent 57cd22bc54
commit 3283950057

View File

@ -76,7 +76,7 @@ virQEMUQAPISchemaTraverse(const char *baseName,
virJSONValuePtr base;
const char *metatype;
do {
while (1) {
if (!(base = virHashLookup(schema, baseName)))
return NULL;
@ -114,7 +114,7 @@ virQEMUQAPISchemaTraverse(const char *baseName,
}
query++;
} while (*query);
}
return base;
}