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:
John Ferlan 2015-05-18 08:42:46 -04:00
parent db1140f117
commit c214f56a82

View File

@ -942,8 +942,8 @@ virDomainKeyWrapDefParseXML(virDomainDefPtr def, xmlXPathContextPtr ctxt)
xmlNodePtr *nodes = NULL;
int n;
if (!(n = virXPathNodeSet("./keywrap/cipher", ctxt, &nodes)))
return 0;
if ((n = virXPathNodeSet("./keywrap/cipher", ctxt, &nodes)) < 0)
return n;
if (VIR_ALLOC(def->keywrap) < 0)
goto cleanup;