mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
conf: Resolve Coverity NEGATIVE_RETURNS
Commit id '73eda710' added virDomainKeyWrapDefParseXML which uses virXPathNodeSet, but does not handle a -1 return thus causing a possible loop condition exit problem later when the return value is used. Change the logic to return the value from virXPathNodeSet if <= 0
This commit is contained in:
parent
db1140f117
commit
c214f56a82
@ -942,8 +942,8 @@ virDomainKeyWrapDefParseXML(virDomainDefPtr def, xmlXPathContextPtr ctxt)
|
|||||||
xmlNodePtr *nodes = NULL;
|
xmlNodePtr *nodes = NULL;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
if (!(n = virXPathNodeSet("./keywrap/cipher", ctxt, &nodes)))
|
if ((n = virXPathNodeSet("./keywrap/cipher", ctxt, &nodes)) < 0)
|
||||||
return 0;
|
return n;
|
||||||
|
|
||||||
if (VIR_ALLOC(def->keywrap) < 0)
|
if (VIR_ALLOC(def->keywrap) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
Reference in New Issue
Block a user