mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 01:18:00 +03:00
tests: qemumonitorutils: Don't crash on wrong monitor command
virQEMUQAPISchemaPathGet returns success when a given schema path was not found but the returned object is set to NULL. This meant that we'd call testQEMUSchemaValidate with the schemaroot being NULL which lead to a crash if a mistyped monitor command was tested. Signed-off-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
e59dc14d1e
commit
33470896e5
@ -564,7 +564,8 @@ qemuMonitorTestProcessCommandDefaultValidate(qemuMonitorTestPtr test,
|
||||
if (virAsprintf(&schemapath, "%s/arg-type", cmdname) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (virQEMUQAPISchemaPathGet(schemapath, test->qapischema, &schemaroot) < 0) {
|
||||
if (virQEMUQAPISchemaPathGet(schemapath, test->qapischema, &schemaroot) < 0 ||
|
||||
!schemaroot) {
|
||||
if (qemuMonitorReportError(test,
|
||||
"command '%s' not found in QAPI schema",
|
||||
cmdname) == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user